Skip to main content

Hi Team,

 

I am trying to json call to read the response of api and process it for further results. This is my example response 

{
"Data": :
{
"Name": "Amount",
"Id": "12345",
"ValueListAttribute_5d": :
{
"term": "Attribute",
"term_Id": "67"
}
],
"StringAttribute_00": :
{
"definition": "Dollar amount",
"definition_id": "5"
}
],
"BooleanAttribute_18e": :
{
"indicator": "true",
"indicatorid": "6"
}
],
},
{
"Name": "Amount",
"Id": "12345",
"ValueListAttribute_5d": :
{
"term": "Attribute",
"term_Id": "67"
}
],
"StringAttribute_00": :
{
"definition": "Dollar amount",
"definition_id": "5"
}
],
"BooleanAttribute_18e": :
{
"indicator": "true",
"indicatorid": "6"
}
],
},
],
"DisplayRecords": 2,
"Records": 2
}

I am trying to read these values using Json call and use them for further processing in my component. But I am not sure how i can read the values. For e.g.: If I need to get indicator how can I get that using Json call.

 

 

Hi Karthikeyan.

Great question!

There is an example in the Tutorials, "01.05 Read json file.plan" (under "01 Reading input"), that I often refer to help with parsing json documents. Even though it uses a Json Reader step the same concepts apply.

To parse embedded arrays, additional Data Streams are used.

In the provided json example we have the array, BooleanAttribute_18e, which contains the "indicator" attribute that we're interested in, as part of the "Data" array. In the step's configuration we configure another Data Stream under the "Data" Data Stream.

We can then link the sub-array contents back to their parents, if needed, using Shadow Columns.

Please let us know if this helps.

Cheers,
Adrian


Hi @Adrian Anderson  Thanks for the response.

 

I am using Json call here but when I run the component, I am getting error like - “The endpoint 'BooleanAttribute_18e' needs at least 1 input/s associated with it. iJson Call (Json Call)] 

Could you please let me know if I am missing something here.


Hi @Karthikeyan .

Since there could be many ‘BooleanAttribute_18e's sections for each Data section, the Json Call step will now have a third output that will contain records with the ‘indicator’ values, similar to the example provided in the original reply:

What we do with this new ‘BooleanAttribute_18e’ output will depend on how we want to process the indicator values in relation to the other values.

By using a Shadow Column to bring the Id from the Data section (as mentioned in the original reply) we could, for example, join this back to the Data output:

Note: The Id of the second Data section was amended from 12345 to 67890 in your original example json to highlight the difference.

If this still doesn’t work, perhaps try just adding a third Text File Writer step and joining it to the new output of the Json Call step to see what information is available there.

Cheers,
Adrian


Hi @Karthikeyan, I’m closing this thread for now, if you have any follow up questions please feel free to share them in the comments or create a new post 🙋‍♀️


Thanks @Adrian Anderson and @Cansu 


Reply


ataccama
arrows
Lead your team  forward  OCT 24 / 9AM ET
×