tags:

views:

506

answers:

2

Hi,

I'm writing some data files in JSON format and would like to have some really long string values split over multiple lines. Using python's JSON module I get a whole lot of errors, whether I use '\' or '\n' as an escape. Is it possible to have multi-line strings in JSON? It's mostly for visual comfort so I suppose I can just turn word wrap on in my editor, but I'm just kinda curious...

A: 

As you can see when you test JSON.stringify of JSON2.js, you can split a JSON string into multiple lines, indenting string : value pairs if you want.

On JSON.org are several Python libraries available.

Marcel Korpel
+1  A: 

JSON does not allowed real line-breaks, you need to replace all the line breaks into \n

S.Mark