Closed thechile closed 9 years ago
That would be nice if it was possible, but it is not. The JSON format does not allow line breaks inside a string.
Wrapping in NeatJSON can force values onto their own line, but in some cases they may exceed the wrap width. For example:
JSON.neat_generate([17,1234567890],wrap:9)
currently generates this:
[
17,
1234567890
]
I could make it try to honor the wrap a little better by doing something ugly like:
[
17,
1234567890
]
but even that is more than 9 characters. There's simply no way to break 1234567890
into less than 9 characters. Though one would think it should not be the case, there's similarly no way to break a string across multiple lines in JSON.
Feel free to re-open if you can find a JSON output that is valid and meets the desire.
Hi,
Thanks for great gem but I'm failing to get the wrap option working. For me it doesn't seem to do anything. Maybe i miss-understood what it does.
Lets say i have:
And i use the
wrap:40
option, that it would output the formatting like below.. so on the 40th character it would wrap the long line. ( ideally on the word boundary and not chop a word in half :) )Reading the options description,
maximum line width before wrapping
, isn't this what it does ?If not, can you explain what it does and maybe this would be a good feature to add please.
Thanks again.