Jump to content

Transform JSON text to Cluster using "Unflatten From JSON"


CIPLEO

Recommended Posts

Hi,

I am looking to transform a JSON string into a cluster in LabVIEW using the "Unflatten From JSON" function.
However I have a problem that I can't find a way to translate an array mixing several data types. Here strings, numbers and cluster (for the cluster, I'm not sure, but since clusters are usually represented by "{}" this is my first idea)

I've put a snip of the code (for example).
test_JSON.png.4197b79f275ca04af434d5b09e01b986.png
I would like to know if there are possibilities to read this kind of JSON string with the "Unflatten From JSON" function or that unfortunately this function does not take into account this kind of case.

Thank you in advance for your answers.
 

Edited by CIPLEO
Link to comment

The short answer about arrays in LabVIEW is that they cannot contain mixed data types.

There is a discussion here about using variants as a work around (https://forums.ni.com/t5/LabVIEW/Creating-an-array-with-different-data-types/td-p/731637) but unless someone is faster than me I'll need to get back to how that translates to your use case with JSON.

 

Edited by codcoder
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.