JSON Toolkit for LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

JSON parsing to LVOOP

Hey all,

Is there any work being done towards creating a JSON.parse and JSON.stringify type method that works with LVOOP objects?  It seems that this is the intended implementation for JSON.  Frankly, I've nearly made this happen on my end, but I keep running in to various roadblocks--it's theoretically possible but there are few elegant solutions with good performance.  I've created my own generic LVOOP class that all my other classes inherit from, and the idea is to have a "To JSON.vi" and "JSON Parse.VI" as methods for that generic LVOOP class.  The closest I've gotten is to flatten an LVOOP object to XML, then selectively do some type checking and inserting data from the JSON in to <Val /> tags, then unflattening that XML back in to my generic object.  The roadblock there is that LVOOP objects, when flattened to XML, don't form XML that contains all of the necessary fields--so I don't have enough information to reliably populate the XML.  I need to know the data types in the LV object--I might have a double from JSON, but will need to add it inside an <I64></I64> tag (for instance) specifically or else I get an error on unflattening.  In general working with that LV XML Schema is a real pain-in-the-ass... what is it, 1998?  In 2013 we serialize object's as JSON!

Any ideas on a better solution?

0 Kudos
Message 1 of 3
(9,551 Views)

FYI, have you seen this.

0 Kudos
Message 2 of 3
(7,238 Views)

Hey that's exactly what I was looking for, thanks!

0 Kudos
Message 3 of 3
(7,238 Views)