unable to form the target Json

Hi ,

I am unable to form the target json (Where multiple tag number needs to be created a seperate document) :

Input Json:

{
“MOCType”:“Temporary Repair”,“MOCStatusUpdatedDateTime”:“2018-10-31T10:00:00Z”,“TagNumber”:“4850-A-101-A01A,4850-A-101-A03C,4850-A-101-A08,4850-A-101-A10A,4850-A-101-A10B,4850-A-101-A10C,4850-A-101-A11,4850-A-101-A12,6320-T-003C”,“Id”:“CLX000A”
}

Output Json:

{
“4850-A-101-A01A” :{
“Temporary Repair (eMOC)”: “OK”
},

“4850-A-101-A03C” :{
“Temporary Repair (eMOC)”: “OK”
},

“4850-A-101-A08” :{
“Temporary Repair (eMOC)”: “OK”
},

“4850-A-101-A10B” :{
“Temporary Repair (eMOC)”: “OK”
}
}

Please let me know if there is a way to handle this request because i am thinking the issue is with the Output Json format and it doesnt seems to be valid.

Thanks,
Lohit

Thanks,
Lohit

Hello,

My solution, although it might not be the most performant, is the following:

  1. Define an input data model in IS that has the same structure as your input JSON
  2. Define an output data model in IS that has the same structure as your output JSON
  3. Parse your input JSON into the input data model using: pub.json:jsonStringToDocument
  4. Map from the input data model to the output data model. You may need a loop but should be straightforward
  5. Transform the output data model in the output JSON using: pub.json:documentToJSONString

Hi Vlad,

Thanks for the suggestion but i could not used the steps shared by you because output json structure was not properly designed by target team.

But I created a java service to form output Json and it is working fine.

Thanks,
Lohit