LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Unflatten From JSON

aggelostsitsigmailcom_0-1726776017766.png

Although with this input I am able to have the correct output  :

aggelostsitsigmailcom_1-1726776051723.png

 When  I try to write more to my JSON string i get this error  :

aggelostsitsigmailcom_3-1726776186466.png

I have tried to change the timestamp and sensor_data types to arrays but it didn't work.

Lastly I would like to parse a JSON file which contains information just like this but i cannot make the function start unless I have a JSON string, which defeats the purpose of reading a JSON file altogether.

Kindly address both my problems.

Thank you in advance 

0 Kudos
Message 1 of 9
(426 Views)

What data type are you trying to get in the second case?

json.JPG

0 Kudos
Message 2 of 9
(411 Views)

Thank you very much for trying to help me .

I will test your solution and come back to you.

In the second case I try to parse a Json file that contains this type of data :

{
        "timestamp": "2024-09-19 20:44:23",
        "sensor_data": "Waiting for command..."
    },
    {
        "timestamp": "2024-09-19 20:44:24",
        "sensor_data": "Sensor started."
    },
    {
        "timestamp": "2024-09-19 20:44:24",
        "sensor_data": "Soil Moisture Value is 0"
}
So that would be string and string
0 Kudos
Message 3 of 9
(402 Views)

But what do you want to get?
only first cluster or array of clusters?

0 Kudos
Message 4 of 9
(396 Views)

array of clusters 

0 Kudos
Message 5 of 9
(392 Views)

In this casetext has to be [{},{},{}], There are no square brackets in your string.

0 Kudos
Message 6 of 9
(386 Views)

aggelostsitsigmailcom_0-1726838352497.png

 when i dont have the brackets i get and invalid string form but when i have them i get a type missmatch 

aggelostsitsigmailcom_1-1726838506314.png

 

 

0 Kudos
Message 7 of 9
(324 Views)

You need to wire an array of cluster for type

0 Kudos
Message 8 of 9
(319 Views)

aggelostsitsi@gmail.com wrote:

aggelostsitsigmailcom_0-1726838352497.png

 when i dont have the brackets i get and invalid string form but when i have them i get a type missmatch 

aggelostsitsigmailcom_1-1726838506314.png

 

 


Now you format it as an array but asks it to unbundle a cluster ...

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 9 of 9
(308 Views)