actionscript-3apache-flexflash-builderflex4.5

Flex : how to pretty print JSON.stringify?


I'm using the built in JSON package with Flex 4.6, how do you get it to nicely format the output, e.g. indent with 4 spaces, put each object on a new line etc.?


Solution

  • The last param is used to insert spaces:

    JSON.stringify(object, null, 4);