LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Selecting an element from json file

novo.PNG

 Hello everyone! I'm tryng to get an especific element from this json file with some controler, but i don't know how to do it, somebody can help me?

0 Kudos
Message 1 of 4
(346 Views)

The built-in JSON code with LabVIEW is... not great.  You need to pre-define a cluster that EXACTLY matches the JSON, both names and data types, or it doesn't work and you get no values out.

 

Instead, look into some of the free JSON libraries.

 

These are the two I have used:

https://www.vipm.io/package/i3_json/

https://www.vipm.io/package/jdp_science_jsontext/

 

I prefer the i3 one for when I want to manually manipulate JSON and the JDP one for when I want to convert JSON to and from LabVIEW data types (type defined clusters mostly) smoothly.  While that 2nd one might sound similar to the built-in version, it actually runs much better mostly because it's forgiving on inexact matches when parsing.

Message 2 of 4
(328 Views)

Another vote for the JDP Science library, it's awesome. If you upload an example json file and what field you want to get out of it I can show you how easy it is in that library.

0 Kudos
Message 3 of 4
(321 Views)

@oliver874 wrote:

novo.PNG

 Hello everyone! I'm tryng to get an especific element from this json file with some controler, but i don't know how to do it, somebody can help me?


Here is another opportunity for me to Learn!

 

AFAIK JSON, like XML, is often a serialized DOM file format.... Document Object Model, DOM. 

 

There are a few presuppositions of files that suppose that the data must be a DOM.

 

DOMUserDefRef.dll is published by the W3C and has no threadsafe calls.  Files that meet DOM criteria presume that a single data bus can read or write that data to storage media. 


"Should be" isn't "Is" -Jay
Message 4 of 4
(252 Views)