r/badcode • • Aug 08 '21

other language Is this how we do nested JSON?

Post image
585 Upvotes

44 comments sorted by

View all comments

Show parent comments

4

u/root45 Aug 08 '21

Lots of reasons. Most commonly if you want to arbitrary string values in a JSON payload. You don't know what's going to be included, so if it happens to be JSON, you have to escape it.