I'm trying to create a json file via shell, however, new lines are now allowed and through an error.
Invalid control character at: line 5 column 26 (char 87)
which points to \n
echo '{
"param1": "asdfasf",
"param2": "asffad",
"param3": "asdfsaf",
"param4": "asdfasf\nasfasfas"
}' | python -m json.tool > test.json
Assuming I'd like to preserve new lines, how can I get this to put a json file?
UPDATE:
I'm thinking it has something to do with strict mode for python's json encoder/decoder.
If strict is False (True is the default), then control characters will be allowed inside strings. Control characters in this context are those with character codes in the 0-31 range, including '\t' (tab), '\n', '\r' and '\0'.
https://docs.python.org/2/library/json.html
How can strict mode be set to False
from within python -m json.tool
?