prettify/format json

Hi All, From our Mendix application we are doing Export to JSON. the generated file contains the details in one line. For example: export is done with details as  {"key":"value","key":"value","key":{"key":"value"},"key":{"key":"value","key":"value"}}   Question : How can we prettify/format json in mendix before the export , so that we have below result in the json file.   {     "key": "value",     "key": "value",     "key": {         "key": "value"     },     "key": {         "key": "value",         "key": "value"     } }      
1 answers



you have three options:

  1. Send your json to an online service for JSON beautify. But probably you don’t want to send your data to some online service, which leaves you with option 2.
  2. Create a java action for pretty-print/beautify of your JSON. There are some java libraries that you can leverage. But be careful not to import too many dependencies, some of them are heave.
    Some examples:
  3. Option 2 of course is also possible as a JavaScript action