From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

JSON Toolkit for LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

JSON parsing too slow and error building tree LabVIEW freezes

So,  I have tried to use this JSON Library and works, but the implementation seems to hang up when parsing larger Data streams.

Want to see it happen?

try to parse this URL: http://pubapi.cryptsy.com/api.php?method=marketdata

Any Suggestions on speeding this up,  am I doing something wrong?


Ben Yeske
0 Kudos
Message 1 of 2
(7,880 Views)

Hey monzue,

Sorry for the significantly delayed response but I just wanted to comment on this in-case others are curious. Yep, you can expect large data sets to take a long time to parse. LabVIEW is hung in that it is thinking really hard but it seems to eventually parse it out for me. Unfortunately the problem is that the toolkit is not a streaming JSON parser and instead actually goes through and validates everything (and there are a couple of other not too great data structure choices in the current toolkit). This is pretty slow for large datasets and the sample set provided, having a large object with many parameters, is a use case that is not handled well (as opposed to a large array with many elements). I have spec'd out designs for a higher performance library but haven't had the time to implement it yet. I'm pretty sure most of the other LabVIEW JSON libraries out there are going to show fairly similar performance problems on large data sets too, but please feel free to post if one handled this case well.

However, in LabVIEW 2013 a native JSON parsing primitive was introduced. The JSON primitive handles many, but not all, use cases and depending on what you are doing it may be beneficial here. For example, if you are extracting a few very specific fields then it should run pretty fast. You can try the attached VI as an example if you are using LabVIEW 2013.

capture.png


Milan
0 Kudos
Message 2 of 2
(5,689 Views)