Assigning empty string to JSON

Hi guys,

I have a document in ESB which I would like to transform it to JSON string below.

{
“groupKey”: “”,
“fullNm”: “Ronnie”
}

I would like to set an EMPTY STRING to groupKey, may I know how to do it? If I leave groupKey empty, it won’t appear in JSON String.

Regards,
Ronnie She Chien Wei

Few points that might help me,

Make sure each field under the IS doc has Allow null=true and if the IS documents have a null value from the upstream system, write a java code to preserve the null or empty values and then pass it to pub.json:documentToJSONString

Hi Ronnie,

The solution is simpler then you think.

  • Click on the groupKey field in your documentType reference
  • In the popup just click OK
  • Feed the document type reference to pub.json:documentToJSONString and it will work.

Hope it helps,
Vlad Turian