It appears this doesn't work anymore:
JSON.stringify({name: 'test'}, null, 4)
Output stays minified.
If you try this simple evaluation in REPL, you will get a 'debug` output. Try this:
console.log(JSON.stringify({name: 'test'}, null, 4));
It works for me:
> JSON.stringify({name: 'test'}, null, 4)
'{\n "name": "test"\n}'
> console.log(JSON.stringify({name: 'test'}, null, 4))
{
"name": "test"
}
undefined
>
Is that what you're seeing @adi518 ?
Here also works:
> JSON.stringify({name: 'test'}, null, 4)
'{\n "name": "test"\n}'
> console.log(JSON.stringify({name: 'test'}, null, 4))
{
"name": "test"
}
undefined
>
Platform: macOS.
Nope, still doesn't work whatsoever. It used to work just fine some months ago.
@adi518 Could you please describe in detail how do you launch the code and what output you get literally?
@adi518 can you try it in the REPL? (Launch node without a file)
Ok, found the culprit. I had a JSON.stringify polyfill that messed it up. So sorry.
Most helpful comment
Ok, found the culprit. I had a
JSON.stringifypolyfill that messed it up. So sorry.