I’m trying to send to the client with django python a json string with newlines:
string += u'hello\n'
data = {'data':string}
return HttpResponse(simplejson.dumps(data), mimetype = 'application/json')
On the browser side i get the string and open it in a text editor but see ‘hello\n’ . is it because simplejson escapes the newlines? How would pass it as a newline instead of the two character ‘\n’?
If you see
\nin a text editor, that’s because you haven’t decoded it. Once you decode it as JSON in the browser it will be fine.