What JSON formatting does
Minified JSON payloads returned by APIs or loggers condense data onto a single line, making complex objects difficult to inspect. Formatting parses the raw JSON string and serializes it with line breaks and consistent 2-space indentation.
Before formatting:
{"user":{"id":101,"name":"Alice","roles":["admin","dev"]}}After formatting:
{
"user": {
"id": 101,
"name": "Alice",
"roles": [
"admin",
"dev"
]
}
}