Simple function that allows you to format serialized JSON.
const source : Object = {person:{name: "Ilya Malanin", age: 26, married: true}, location: {country: "Russia", city: "Tomsk"}};
var result : String = formatJSON(JSON.stringify(source));
Result:
{
"person": {
"name": "Ilya Malanin",
"age": 26,
"married": true
},
"location": {
"country": "Russia",
"city": "Tomsk"
}
}