Skip to content
Not available in DartThis function is not part of the Dart package. The documentation below is for JavaScript and Python.

objToPrettyStr

Recursively output all the steps of the JSON object (JSON.stringify) and then output the JSON object with newlines and tab characters to make it easier to read in a console function, for example.

Parameters

NameTypeRequiredDefault
objobjectdict

Returns

string

str

Examples

javascript
objToPrettyStr({ a: 1, b: { c: 1, d: 2 } }); // Returns '{\n\t"a": 1,\n\t"b": {\n\t\t"c": 1,\n\t\t"d": 2\n\t}\n}'
python
objToPrettyStr({ 'a': 1, 'b': { 'c': 1, 'd': 2 } })  # Returns '{\n\t"a": 1,\n\t"b": {\n\t\t"c": 1,\n\t\t"d": 2\n\t}\n}'

Released under the MIT License