JSON Toolkit for LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

JSON in LabVIEW!!

Hey are you guys actively working on this?  What's the status?  I was going to fire up a JSON parser myself and stumbled on this.  If you don't get around to it I'll probably have something working in short order, and if you do get something to work, I have a billion uses for it--would love to share when that time comes.  Toss me a note, I'd like to learn more about your proposed implementation.

0 Kudos
Message 1 of 15
(37,417 Views)

Hi Synaesthete!

We actually have a full release made but got busy and have not expanded on the community page. It is part of a series of projects to beef up communication with different web services in LabVIEW! You can see the download for the JSON toolkit here: https://code.google.com/p/i3-labview/downloads/list

Unfortuneately it is not well documented yet (we pushed a release with low documentation for the Twitter toolkit at NIWeek's LabVIEW Hacker session) but if you have any questions I would be glad to help out!


Milan
0 Kudos
Message 2 of 15
(19,323 Views)

Hey Synaesthete!

I don't know if you have tried the JSON toolkit yet, but we have added some features that make it easy to parse and generate json that can be structured in LabVIEW clusters and arrays. Of course you can use the other JSON VIs to iterate through structures that might not map nicely to LabVIEW types, but the new features make it easy to convert back and forth and filter large data sets. It has not been pushed to the downloads page yet but if you wanted to try it out I will attach a copy to this post. The documentation and examples are still being cleaned up, but if you want to try it out that would be awesome. :]

Here is an example of what it looks like:

JSONfp.PNG

JSONbd.PNG

Edit: One thing I forgot to mention is that you will need the JKI VI Package Manager to install these toolkits (and if you are using the twitter API the release of the JSON API in this post might break Twitter, but an update of Twitter / OAUTH / JSON is coming soon if you want to use the Twitter API and these new JSON parsing features)

Message was edited by: MilanR  Went ahead and removed the older i3-json-2012-10-16.vipc package. Users can find the newest version on the home page: https://decibel.ni.com/content/groups/interactive-internet-interface-json-toolkit-for-labview


Milan
0 Kudos
Message 3 of 15
(19,323 Views)

Bingo   I did play around with it but noticed there wasn't a convenient way to do what you've done there with the clusters.  I am definitely interested in trying out the latest rev that you guys have.

0 Kudos
Message 4 of 15
(19,323 Views)

Hey Synaesthete!

Just wanted to mention that the newest release (and future releases) of the Interactive Internet Interface: JSON Toolkit for LabVIEW are available on the homepage for the project! The newest release fixes a couple of small bugs, has completed polymorphic VIs for generation of JSON data, and adjusted scope properties for the lvlib which is important for projects using the library.

Let me know if you run into any problems!


Milan
0 Kudos
Message 5 of 15
(19,323 Views)

Thanks for the update!  I've been playing around with the toolkit quite a bit and at this point it satisfies all the requirements of my current project.  Amazing timing, really appreciate it.  I'll make sure to fill you in on any bugs, etc.

0 Kudos
Message 6 of 15
(19,322 Views)

Thank you very much, this is a very useful library already!

I noticed a small issue with conversion of floating point numbers to json. Very small floating point numbers such as 532E-9 will be represented as 0.000001 due to the %f formatting, while it would be more appropriate to use the E-notation with %g formatting. This was quickly fixed by myself, though I thought to let you know.

Thanks again for this fine library,

Tom

0 Kudos
Message 7 of 15
(19,322 Views)

Hi Tom,

Haha I knew someone would catch that soon!

I have code in the work that adds the ability to specify format strings for JSON numbers that are generated so every number can include a format string. Been pretty busy with a couple other projects lately, but I am glad you have a workaround and I hope to make an update in a couple weeks!

And just because anyone who appreciates a Twitter toolkit and JSON API would probably like this other side-project as well:


Milan
0 Kudos
Message 8 of 15
(19,322 Views)

Thanks MilanR,

I am glad you are already working on this.

In the meat time I also noticed that arrays of arrays don't maintain their ordering. Internally the subarrays are numbered; however, before the conversion to json these numbers are sorted as strings, not numbers. Again, once I found what the problem was, this was relatively easy to fix.

Thanks again,

Tom

0 Kudos
Message 9 of 15
(19,322 Views)

Hi Tom,

Thanks again! I found the spot in JSON generation that you are talking about and, yep, that was definitely a silly oversight. I converted the array of strings into an array of numbers for sorting and it seems to work, but it is a lot of overhead so I may look into alternative implementations in the future. Either way, for large 1-D arrays of Double, String, and Boolean there is already an abstraction to make those quicker so I am hoping those are used in most cases of JSON generation.

I'll make sure to include that fix in the next release


Milan
0 Kudos
Message 10 of 15
(19,322 Views)