LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Extract a name/value pair array from flattened JSON

Solved!
Go to solution

Hi,

 

I've got a JSON string containing an array of name/value pairs:

 

{ "params":[

                   {"name": "Param1", "value": "10"},

                   {"name": "Param2", "value": "20"}

                 ]

}

 

For the moment I'm extracting the whole array by iterating over the array index until an error is generated, as shown in the picture below.

 

This is not very nice as it always generates an error (could be ignored) and also the resulting array contains at the end an empty element.

 

Is there an easier way to achieve this goal?json_array.png

 

 

 

0 Kudos
Message 1 of 3
(3,104 Views)
Solution
Accepted by topic author Batlan

Ok, found the solution myself.

 

Simply omit the path and enter as type a cluster with a named array ("params") ofjson_array_solution.png clusters containing a"name" and "value" constant .

Message 2 of 3
(3,089 Views)

thx for this post, helped me to solve my problems with a similar problem !!!!

0 Kudos
Message 3 of 3
(2,996 Views)