08-08-2026 02:05 PM
I am new to JSON in general, trying to use JSON text to extract some info from my configuration file. I feel like there is an efficient way to do this. Basically, trying to create a VI to extract info based on the key & value pair I pass in. it works but looking to see if there is an efficient way.
LVEnt_0-1786215714178.png
attached json as a txt file.
Solved! Go to Solution.
08-10-2026 04:48 AM
Change the cluster array to a Map and it'll be cleaner. You also don't need the shift register and build array, just concatenate the array on the output (not needed with a map).
Something like this:
Yamaeda_1-1786355316602.png
08-10-2026 07:47 AM
@Yamaeda wrote:
Change the cluster array to a Map and it'll be cleaner. You also don't need the shift register and build array, just concatenate the array on the output (not needed with a map).
Something like this:
Yamaeda_1-1786355316602.png
Be carefull here, in the author implementation, all key / value pairs are concatenated. There are duplicates for each "signal_generators". In yours, all key value pairs are inserted into 1 map, discarding previously already inserted key values.
@LVEnt it would be easier to help you if we have a JSON example / schema to work with.
08-10-2026 10:36 AM
I'm not sure how many records you have or how much access you need, but a SQLite database might be a nice choice. It's a "database in a file" format so you don't need a server or anything. The author of the JSONText library you're using also has a SQLite library and it's great.
08-10-2026 11:20 AM
Depending on how flexible you need this (like does "signal_generators" need to be a runtime input?) you could do all the filtering in LabVIEW after one JSON conversion.
avogadro5_1-1786378791228.png
08-10-2026 11:27 AM
I have a json config file attached to my OP.
08-10-2026 11:29 AM
I want to have the flexibility to add or remove a field in the json, so my cluster cannot be a constant. This is one reason I started looking into jsontext.
08-10-2026 12:26 PM
Here's a different implementation that uses "find item.vi" to avoid one loop layer and does not create array elements that will not be needed.
avogadro5_0-1786382090698.png
For this to be somewhat robust you should try to raise an error (or otherwise handle) if multiple items or 0 items match the search criteria
08-10-2026 01:57 PM
can you attach the VI please?
08-11-2026 03:18 AM
@LVEnt wrote:
I have a json config file attached to my OP.
Sorry, I missed it 😅