hazarath - 2024-07-30

I want to extract each element of an Array. Can someone help me with this. When I use JSONElementToString (part of JSON Utilities SL), I am seeing output as "ARRAY" instead of actual data.

Here is the JSON content that I want to read :
{
"value1Unit": {
"units": "M"
},
"data": {
"stepSize": 300.23,
"points": [6,8]
}
}

I would like to read each item of the element "points" i.e. 6 and 8.
Here is the code I used,

// Reading the content as JSON
reader (
 xExecute := execute ,
 pwData := ADR ( converted_value ),
 jsonData := jsonDataStorage
);

 // Get the JSON Element
jsonDataStorage.FindFirstValueByKey( 
wsKey := fidKeyVar,
 diStartIndex := searchElem,
 jsonElement => jsonElement
 );

  JSON.JSONElementToString (
 element := jsonElement ,
 wsResult := valueWstring
 );

The content of the output of valueWstring is shown as "ARRAY" instead of the array items i.e. 6 and 8
Please can someone help me.

 

Last edit: hazarath 2024-07-31