05-25-2015 08:14 AM
I was surprised to see that "JSON" turned up zero search results in this board.
Over the years we have added the ability to export the contents of our reports to Word, Excel, text, XML, HTML, etc. This leads to a lot of similar code that is cumbersome to maintain. Additionally some of the underpinning technologies may be coming close to the end of their supported lifetimes. (e.g. DDE, ActiveX, ..). I have done some XML exporting, but it has proven to be (a) verbose and (b) cumbersome to code. I have not spent the time to abstract away the tedium of generating XML, and in the mean time JSON seems to have won out over XML.
So, I'd like to move to a model where there is ONE consistent way to export the data from our app, and further details of presentation can be handled separately. The data is very tabular, and what I'd love to be able to do is throw a 2-d array with a list of column and row labels to a tool that will serialize the data in JSON to a specified precision.
Does such a tool exist?
Comments/suggestions welcome!
Thanks,
Ian
Solved! Go to Solution.
05-26-2015 03:29 PM
Hi Ian,
I wasn't able to find anything myself, but to clarify, are you looking for a C programming equivalent of the Flatten to JSON function in LabVIEW?
http://zone.ni.com/reference/en-XX/help/371361K-01/glang/flatten_to_json/
05-28-2015 09:40 AM
Thanks, Michael. That looks like the right kind of thing. I have seen some general purpose tools like Jansson (GitHub and info links) and on CCAN (here and here), but that LabView tool is the kind of thing I was hoping for, with much of the lower level taken care of.
I need some time to delve into those two C options to give them a fair assessment.
But it would be great if CVI had some sort of JSON tools on the roadmap. 🙂
--Ian
05-29-2015 10:31 AM
I see! If nothing exists currently, this might be worth a post to the CVI Idea Exchange so that the devlopers could consider it for future versions:
http://forums.ni.com/t5/ideas/v2/ideaexchangepage/blog-id/cviideas
06-21-2016 10:31 AM
I added this idea to the idea exchange forum.
Feel free to support it, if you think this can be useful.
02-17-2022 02:40 AM
Old thread, i've succesfully used cJSON in my project, just imported the .c and .h file, it's compile correctly, no need to import any .dll or .lib
02-17-2022 03:01 AM
Personally I've used json-c