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
I have had to do this for a small Node.js project and found this work-around:
{
"modify_head": [
""
],
"modify_body": [
"",
""
],
}
This looks quite neat to me, appart from that I have to use double quotes everywhere. Though otherwise, I could, perhaps, use YAML, but that has other pitfalls and is not supported natively. Once parsed, I just use myData.modify_head.join('\n')
or myData.modify_head.join()
, depending upon whether I want a line break after each string or not.