cancel
Showing results for 
Search instead for 
Did you mean: 

Convert the Data to nested Json Document

akarsh
New Contributor III

My Input looks like this. 

[
{
"error": "",
"stacktrace": "",
"reason": "",
"resolution": "",
"status_code": "",
"statusCode": 404,
"snap_details": {
"label": "",
"instance_id": "",
"class_id": "",
"build_tag": ""
},
"External_id__c": ""
}
]


I have to send the output in below format, 

{
    "External_id__c": "",
    "status": "",
    "updatedTime": "",
    "error": {
      "statusCode": "",
      "error": ""
    }
  }

 Can anyone help me here.

1 ACCEPTED SOLUTION

Aleksandar_A
Contributor III

Hello @akarsh.

You can try by using Mapper with the following Mapping table:

AleksandarAngel_0-1705398978353.png

Here I assume that as updatedTime you want to take the current time, if your requirement differs, just remap it correspondingly. 🙂

Let me know if this helps you.

Regards,

Aleksandar.

View solution in original post

4 REPLIES 4

Aleksandar_A
Contributor III

Hello @akarsh.

You can try by using Mapper with the following Mapping table:

AleksandarAngel_0-1705398978353.png

Here I assume that as updatedTime you want to take the current time, if your requirement differs, just remap it correspondingly. 🙂

Let me know if this helps you.

Regards,

Aleksandar.

akarsh
New Contributor III

I tried that but getting below error. anything I am doing wrong here? 

akarsh_0-1705400285819.png

akarsh_1-1705400312804.png

 

It is because upstream of the Mapper Snap, you have the error field as string and you are trying to pass it through but in the same time you are mapping it to an object in the Mapper Snap.

akarsh
New Contributor III

Yes that was the Issue, Thanks a lot @Aleksandar_A