Closed gagan-bansal closed 8 years ago
Interesting requirement. I'm not clear on what the wrapping rules would be. If you can make a pull request, or even very clear rules, I'll happily consider merging it.
In your example, you seem to be arbitrarily allowing newlines in some cases, and disallowing them in others. Why not this:
[{"id": 1, "product": "pumad", "price": 48, "color": "yellow", "available":
true, "tags": ["bravo"], "vendor": {"name": "Lizzie Chapman", "address":
{"city": "Mumbai"}}}, {"id": 2, "product": "rupasge", "price": 35, "color":
"red", "available": true, "tags": ["delta"], "vendor": {"name":
"Ellen Harrison", "address": {"city": "New York"}}}]
Is the rule that Object keys must always stay with their values? If so, then why not:
[{"id": 1, "product": "pumad", "price": 48, "color": "yellow",
"available": true, "tags": ["bravo"], "vendor": {"name": "Lizzie Chapman",
"address": {"city": "Mumbai"}}}, {"id": 2, "product": "rupasge", "price": 35,
"color": "red", "available": true, "tags": ["delta"],
"vendor": {"name": "Ellen Harrison", "address": {"city": "New York"}}}]
What rule forces a newline after ["bravo"]
in your example?
Again, I like the output option, but I don't understand it. If you can put forward unambiguous rules, I will consider coding it. If you provide a pull request implementing something sensible, then I will very likely accept it.
Thanks for considering my requirement. There could be three rules 1) Each item/object in array at first depth should start with new line 2) Each item/object in array should be wrapped to 80 (wrap option) 3) Key values must be together as you mentioned in in your second example
My requirement is not very critical just to show the json on github issues or README in compact manner so no need to spend mush time if you feel this is not a generic requirement.
I am looking for compact output but readable, here is my data:
with following command:
output is:
My requirement is to get output wrapped at 80 col:
Would it be possible to get such output. I am looking for this option to show the json data on stackoverflow or github issues or README file.