
Hi Team I have 2 "errorDetails" json objects as below with same key. I need to generate 1 object with errorDetails from 1st object. only "errorDescriptionTechnical" should be combined. I tried ++ but they are showing up in same line. I need them in a separate line. \n is not working
"errorDetails": {
"category": "MULE:EXPRESSION",
"errorCode": "2011",
"errorDescriptionTechnical": "Error occurred while inserting the data into the database"
}
"errorDetails": {
"category": "DB:CONNECTIVITY",
"errorCode": "2010",
"errorDescriptionTechnical": "Error occurred while connecting to database"
}
Hi @Tulasi Jangala you can try the below dw script :
%dw 2.0
output application/java
var ed1= {"errorDetails": {
"category": "MULE:EXPRESSION",
"errorCode": "2011",
"errorDescriptionTechnical": "Error occurred while inserting the data into the database"
} }
var ed2= {"errorDetails": {
"category": "DB:CONNECTIVITY",
"errorCode": "2010",
"errorDescriptionTechnical": "Error occurred while connecting to database"
}}
---
({
"errorDetails": {
"category": ed1.errorDetails.category,
"errorCode": ed1.errorDetails.errorCode,
"errorDescriptionTechnical": "$(ed1.errorDetails.errorDescriptionTechnical)\n$(ed2.errorDetails.errorDescriptionTechnical )"
}
})