NI Home > Community > NI Discussion Forums

LabVIEW

Showing results for 
Search instead for 
Do you mean 
Reply
Trusted Enthusiast
SteveChandler
Posts: 2,250
0 Kudos

Re: Has anyone implemented JavaScript Object Notation in LabVIEW?

Go to the idea exchange and vote for this. One of the best ideas and only has 19 votes.

 

I wrote an encoder but cannot share it because it was something that someone paid me to do. I can explain it though.

 

The VI takes a cluster reference and produces a JSON string representing the cluster. It supports strings, integers, floats, booleans and arrays. It also supports paths, VISA references and such representing them as strings. It iterates over the cluster Controls[] property looking at the Value property and determines the type by examining the type string from Variant to Flattened String. I found out later that there is something buried in vi.lib that does the same thing.

=====================
LabVIEW 2012


Member
rayclout
Posts: 187
0 Kudos

Re: Has anyone implemented JavaScript Object Notation in LabVIEW?

Hello Jose

I managed to get a working code, but went away from using the UDP functions...it proved too difficult.

 

I simply read the data file in using the xml format, then stripped out the data that I wanted. The code can be used on a system with as many inverters connected to the SunnyBox as you like, and you can strip out as many of the data values as you like. The file downloaded from the webbox comes in a zipped format and the code can even do the unzipping for you.

 

If you are interested I can dig out the appropriate code and post it. 

 

regards

Ray

Member
Jose_Perez
Posts: 148
0 Kudos

Re: Has anyone implemented JavaScript Object Notation in LabVIEW?

Ray,

 

That sounds interesting. I would like to see that if is not too much trouble.

 

Thanks,

 

Jose

Member
rayclout
Posts: 187
0 Kudos

Re: Has anyone implemented JavaScript Object Notation in LabVIEW?

Jose

Ok....I'm not in front of my work pc at the moment, but as soon as I am, I'll post the code for you.

 

regards

Ray

Member
Jose_Perez
Posts: 148
0 Kudos

Re: Has anyone implemented JavaScript Object Notation in LabVIEW?

Thanks Ray,

 

Jose

Member
euio
Posts: 1
0 Kudos

Re: Has anyone implemented JavaScript Object Notation in LabVIEW?

Ray, I would also like to see your code.

Member
Philmod
Posts: 19

Re: Has anyone implemented JavaScript Object Notation in LabVIEW?

Here is an implementation of a Labview JSON encoder: https://github.com/Philmod/Labview-JSON

 

Feel free to contribute!

Trusted Enthusiast
SteveChandler
Posts: 2,250
0 Kudos

Re: Has anyone implemented JavaScript Object Notation in LabVIEW?

Feel free to mention me in the copyright :-)
=====================
LabVIEW 2012