CIPLEO Posted February 9, 2023 Report Share Posted February 9, 2023 (edited) 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). 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 February 9, 2023 by CIPLEO Quote Link to comment
codcoder Posted February 9, 2023 Report Share Posted February 9, 2023 (edited) 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 February 9, 2023 by codcoder Quote Link to comment
cordm Posted February 9, 2023 Report Share Posted February 9, 2023 Have you seen this thread at the NI forum: https://forums.ni.com/t5/LabVIEW/JSON-difficult-to-parse/td-p/3338777? With the built-in method you would have to write some additional code, but JSONText seems to do that out of the box. 1 Quote Link to comment
CIPLEO Posted February 10, 2023 Author Report Share Posted February 10, 2023 Thank you for your answers. I will look at these threads. 1 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.