02-14-2017 12:31 AM
Hi Developers,
Problem Statement : I have developed code to open an existing JSON file using LabVIEW and also update the key elements (single value) depending upon the user needs.
Now, I want to over-write the updated JSON file in the same location as before.
I am unable to convert the JSON Object variant back to the string by using the flatten from JSON, so that I can over-write the corresponding JSON file.
Attachment : 1) JSON file 2) VI to open and update the JSON (SubVI)
3) test.vi (main VI)
Solved! Go to Solution.
02-14-2017 02:29 PM
You need to use the functions provided by the library for reading the values, updating the values, and then encoding the Variant Data type containing the JSON data back to a string. See below (you'll need to add the File Write operation back in):
In the above, Updated JSON has the following in the indicator: {"library":{"novel":"donald","study":"physics"}}
02-14-2017 09:58 PM
Thanks izachdx the solution seems to work. The only thing the structure has to be maintained till the end.
07-12-2017 03:17 PM
Hi Zach,
I don't find these JSON function in my LabVIEW version 2016. Is there some sort of library that I need to download? If so, please guide me through the link.
Thank you!
Jatin
07-12-2017 04:38 PM
You need to download these functions using VI Package Manager (VIPM). Search in VIPM for "i3 JSON" and then install that package.
08-02-2017 03:33 PM
I've just release a new JSON library, JSONtext, part of the purpose of which is to eliminate a lot of the verboseness of using the currently available 3rd-party JSON libraries. Above is a good example, as it takes five libary subVIs to change one JSON subitem. In JSONtext, the equivalent operation is just one subVI:
03-01-2019 01:08 AM
Hi dear,
Can you give example for labview 2011 or is there any method that I can try to use JSON FORMAT in labview 2011?