How to append Json deserialize value to variable?

There is an multiple object only need to append "expenseReportId" attribute value to another variable, 

The expenseReportId deserialized form JSON deserialize the list of values need to append how can be achieve? .

List-append won't work structure data type is not List.



Regards,

Robert

Hello Robert.

What data types are we talking here?

Can't you use Assign?

Hello Nuno,


Data type is structure created form JSON, Assign will replace the value need to append multiple values ??.


Regards,

Robert

You can combine them with String_Join (from Text extension).

String_join will it work? to append list of values to a list variable

I thought you said it was overwriting the data. String_join is to save into a single variable.


Let's do this step by step.

If you are doing a loop, you can save one from the original structure to a variable/record that matches the type of destination list. if variable, it is straightforward. If record, use Assign and fill the mapping section to pair source attributes to destination attributes.

To save to destination list, you Append.that Variable/Record you created.


Hi Robert,

It seems that you have a list called expenseReportIdList, which is a list of expenseReportIds and you want to append expenseReportId value that comes from the JSON.

The structure created when you deserialize the JSON returns a single expenseReportId or a list of expenseReportId that you want to append?


If it is just a single expenseReportId, you can create a local variable to store this value, assign it and append it. You can also append the expenseReportId directly into your expenseReportIdList.

If it is a list of expenseReportId, you can create a local variable to store an expenseReportId, but you need to perform and additional loop over the list in which you assign the variable and append it to the expenseReportIdList.


Kind regards,

Rui Barradas

Hi Jonhson,

Check whether the referred Data Type i.e. Structure mapped with JSON Deserialize node is same as the referred structure for Local List Variable data type as shown below 

                             

If their is a miss match in the source record/Element structure and the List structure while using the ListAppend server action it will throw an error.

Hope this helps you!


Regards,

Benjith Sam

Benjith Sam wrote:

Hi Jonhson,

Check whether the referred Data Type i.e. Structure mapped with JSON Deserialize node is same as the referred structure for Local List Variable data type as shown below 

                             

If their is a miss match in the source record/Element structure and the List structure while using the ListAppend server action it will throw an error.

Hope this helps you!


Regards,

Benjith Sam

Hi Benjith,


Thanks for your response, as per the attachment I had changed the data type, and finally trying to assigning value to a "Final structure" variable still not working.








  • Finally assigning the temp variable to "final structure" as below screen.



Output :


ID should be as test data "tr" and "tw" but instead of append it is overwriting :(


Error : Failed to deserialize JSON to SAEDATAList: