Fortunately, there is a quick and hacky solution to this JSON data and coding conundrum!
JSON multi-strings examples
Imagine that we have a list of servers and their associated public keys. To store that data as JSON, we could store it as an array of comma-separated string objects, which might look something like this JSON file example:
|"-----BEGIN PUBLIC KEY-----",|
|"-----END PUBLIC KEY-----"|
You can verify that this valid JSON with JSONLint.
Retrieving the JSON language to JSON new line
Then, to retrieve our text block, we just have to join them back together on the newline characters, which we can do like this:
And that's it! Now you can store multiline strings and get results in JSON single line. It's not the prettiest thing, but it is the simplest given the constraints of JSON.