81
Views
2
Comments
Solved
Converting JSON to key/value pair
Question

Hi all, 

I had read a few posts on the forum regarding the Json to key/value pair using action from ardoJSON, but it works for basic structure (to map to key/value pair). What if the JSON passed is holding same value but with a different structure, how can we convert it into a key/value pair?
What I've tried :
Deserialize the structure using DeserializeJSON in OnRequest
Using JSONListify in OnRequest
And I'm receiving those errors which I believe the mismatch of structure is causing it :

Failed to parse JSON request content.
Failed to parse JSON request content.
Failed to parse JSON request content. 

I've attached my JSON file below. 
Noted that multiple structures are using the same name "value". 
Also, how can we extract a portion of the JSON for usage only instead of converting the whole json into a usable structure? 
Is it possible to map the attached json into just a simple structure (key/value) List? 

Any feedback is very much welcomed. Thanks.


Kenny 

masked.txt
2021-10-09 07-57-44
Stefan Weber
 
MVP
Solution

Hi. I have created a Forge Component for JSONata a powerful JSON transformation DSL. Here you will find details and a getting started guide https://without.systems/transform-json-data-with-jsonata-in-outsystems

2023-11-14 07-36-16
Yung Shin

Hi Stefan,

Thanks for the forge! Never knew there was a forge having such capability and flexibility. I managed to extract the information I needed and converted a record structure into a list. 

Thanks again and have a pleasant day ahead!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.