Forum Discussion

akarsh's avatar
akarsh
New Contributor III
2 years ago
Solved

Convert the Data to nested Json Document

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.

  • Hello akarsh.

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

    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.

4 Replies

  • Hello akarsh.

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

    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's avatar
      akarsh
      New Contributor III

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

       

      • Aleksandar_A's avatar
        Aleksandar_A
        Contributor III

        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.