Pentaho

 View Only

 JSON Output escaped

  • Pentaho
  • Pentaho
Peter Steuber's profile image
Peter Steuber posted 10-23-2021 04:06

Hi All,

 

Learning Pentaho and it always escapes my outputs. What can I do to stop Pentaho from escaping quotations when I transform a JSON file? My desired output would be "fruits": [ "Apples", "Bananas" ] NOT "fruits":"[\"Apples\",\"Bananas\"]"

 

INPUT:

{  "ArrayExample": [  {  "fruitId": "asdasg22389khsdall"  }  ],  "name": "Test",  "fruits": [  "Apples", "Bananas"  ] }

 

 

OUPUT:

{  "data": [  {  "ArrayExample": "[{\"fruitId\":\"asdasg22389khsdall\"}]",  "fruits": "[\"Apples\",\"Bananas\"]",  "name": "Test"  }  ] }

 

Andrew Cave's profile image
Andrew Cave
The problem is the the JSON fields/values are being quoted with doublequotes and your string value contains doublequotes too.  So Pentaho will escape so they are confused with the end of the value field.  Use single-quotes instead.