How to best embed JSON data?

I’m using BSS to design a template which will later be used by a file-exporter and embed some JSON data.

While developing it in BSS I would like to use some test-data and embed it in a way that preview sees it or that the exported size contains it. Since the test data is quite big, I don’t want to cut & past this manually but load it/embed is somehow.

Is there any way to reference a local file and have it included? Like in a pre-processing step?

While what you are attempting is way beyond my skill level, I can tell you that BSS is basically unable to access anything off your computer and display it in the BSS workspace or preview. The only files that the program can display in the workspace or preview window are those which it directly supports through import… images, CSS, JS and fonts. You cannot “connect” spreadsheets, videos, PDF files, or anything else the program doesn’t allow you to import.

To show your data in the browser preview, it would need to be placed on your webserver, and referenced with an absolute path (probably via a custom code component I would imagine.)

That said, as this question does not relate to the use of the Bootstrap Studio software itself, you are probably more likely to get an answer if you post it in the Webdesign Help category, where people more knowledgeable with these kinds of requests are more likely to see it.

While what you are attempting is way beyond my skill level,…

Well, I suggest you take a look at what embedding means. What you describe is all clear.

Of course, can I access embedded data, whatever it is, because it gets included in a generate HTML or JS file. BSS can’t see a difference. I could even do this with an export script, but that’s post-processing…

The use-case of embedding some assets makes a lot of sense when you create an HTML file that is just opened on a local system. In that case, you don’t have a server, which can serve any assets.

I think what PJ is basically saying is you cannot do what you’re seeking to do. Local files cannot be read within the app or the preview window at this time unless you upload the files you want read to a location online and utilize Absolute URL’s. The app just isn’t able to see outside of itself without a direct link.

Having said that, there are some that have posted about using a local host setup to allow for using local files, but that’s above my paygrade too. Try searching the forum maybe and see if you can find something on “Local Host”. You’re bound to come up with the posts that were discussed here and how to do it.

@robert_m_muench

You can use FileReader to embed local files into your design and see it when you preview your design in a browser.

It’s not about reading local files or serving local files…

My point is about embedding (during exporting, or preview as a pre-processing step) data either from dropped-in-files or by a declaration in the project files. Like a C preprocessor handles include files.

Background is, that using static HTML files (which contain all stuff necessary) as reports generated by some tools, makes a lot of sense. But those files are just opened from the local filesystem, no server involved. Hence, all business data used by the report needs to be embedded. External libs can of course be loaded from some other servers.

And I would like to use BSS to be able to handle this for testing. Later on, my app will use the generated HTML and do the embedding/replacing itself.

Let us know if you get something worked out for this, but I truly don’t think BSS is capable of doing what you need it to do. As I said earlier, it cannot recognize files anywhere other than within the program or with an absolute links. I could be wrong, there may be some way to create a script or something for it, but …

Anyways good luck on it, I’ve nothing more to add so I’ll bow out here. :slight_smile:

Unfortunately there are various things founds across modern web development that BSS is a bit awkward at or does not allow ways to support. Leaving development orphaned across the lifecycle from BSS in app to accomplishing what one wants overall.

@robert_m_muench Maybe you already saw this post, but Martin said short of a year ago he had hoped to address JSON support in some fashion. So maybe at some point things will improve.

I admit I’m not an expert when it comes to website development, and I am definitely not a programmer, but in terms of computer parlance, I’ve always understood “embedding” to mean that the asset in question is included directly in the file itself. For example, an “embedded” image in an Adobe Illustrator file is different from a “linked” image, which can reside in some location outside the program. It will display fine as long Illustrator has access to the location of the linked image. But if the linked image is located on my desktop, and I were to send you the Illustrator file, and you opened in on your computer, the program would complain upon opening that a linked asset is missing. If I “embed” the image, that doesn’t happen.

Is that an accurate description of “embedding?”

Whatever it is that you are trying to do I have never needed to do, hence my ignorance. If I were to get a request from a client to do whatever it is, then I would either teach myself, or find someone to teach me (probably @kuligaposten :stuck_out_tongue:), or as a last resort, hire someone.

But I do have a pretty good grasp on the basic functionality of the current version of the BSS software, and it cannot embed/import data files.

Perhaps you can use custom code components to put what you want on your page for development purposes, and then delete them before you generate your final files for upload?

Hahah… I just noticed you wrote PJ! :rofl: :joy: I’m captain Pajamas! :man_superhero:

We are working on JavaScript module support right now, and some of the changes we are making would enable us to add JSON files in the future. So expect to see this in our next releases.