I am receiving both Json object and json array from API, I need to convert those JSON object to Json array, Like Mentioned below
INPUT: -
{
"jsonObject":
"name":"John",
"age":30,
"city":"New York"
}
OUTPUT: -
[ {
"city":"New York" } ]
How to achieve this?
Hi shubhangi kendre,
You can create a structure according to your use because in OutSystems, an array is considered a list.
I have attached the screenshot below for your reference.
First Structure -
Second Structure -
Thanks,
Vipin Yadav
Hi Vipin
Example: I am getting a response from the API, it will have multilevel structure,
suppose if there is a object like
"TCRMService" : {
"Object1" : {
"Name" : "CTS",
"Place" : "Chennai"
"Object2" {
"Address" : "P O Box 10",
"Country" : "India"
system will pass this Json response to server action and expect output is below structure eventhough it is a single object.
"Object1" : [{
} ],
"Object2"[ {
}]
This Forge component:
https://www.outsystems.com/forge/component-overview/413/ardojson-o11
Has many features to manipulate and process JSON structures, maybe it helps.
Hi Shubhangi,
Your question is exactly the same as that of Manikandan. Is it a colleague of you, or are you posting from two accounts?
I had the same feeling here!
Hi,
Using java script to convert json to arrya object
const ArrayObject = JSON.parse(<Json text>);