Pretty funny considering JSON is self described as "easy for humans to read and write." If your target is nontechnical folks, I wonder if it would be useful to go a step further and:
- Remove quotes from strings. They're already formatted differently.
- Remove array indices.
- Unescape strings.
The context and formatting should still be enough for devs, but I can't imagine quotes or indices do anything for nontechnical people.
about removing quotes from strings, I tought about it, and I think as long as some other display property is different (to differentiate the number 4 from the string "4") and something more than color to avoid causing trouble to colorblind people I think it's a good idea.
the array indices I was thinking on having it as an option, I would like 'something' to make them standout as lists even when no index is displayed, any idea?
I agree. The "code" in the example page is, to me, easier to understand than the "human-readable" output.
For me, it's about spacing efficiency (I can see more at once), formatting (e.g., italic is not as easy to read as roman faces), and color (green on grey? huh?).
But I've always been a fan of plain-text in general. I'd much rather use plain-text markdown than MS Word, or edit code in plain files as opposed to an IDE. Plain text, to me, is much more WYSIWIG than any GUI tool I've used. But I understand that not everyone thinks the same way.
Yes, but non-technical project members may not. This is pretty useful to pretty-print this information so it's readable in design docs, etc (it doesn't replace the json raw data, just explains it a bit better)
the lib from this article is more tailored for apps that want to display arbitrary json to a broad range of users. As someone asked, there are not many uses, but I have one in my web app (http://event-fabric.com/)
This is great! And nicely written--it would be very easy to modify this to format things differently. Eventually, it would be cool to have the conversion go both ways. That way it could be incorporated in a CMS (arbitrary structured content being passed around as JSON but displayed and edited in HTML).
I dump my JSON as YAML. Even if you are not using YAML for saving data (and I don't -- in Python at least PyYAML is orders of magnitudes slower than the built-in JSON), it is nicer to read.
YAML was my first thought as well. Why not a library that converts back and forth and displayed the YAML in a pre tag or textarea? Then you could edit the YAML and after converting back still have valid JSON.
YAML is a superset of JSON, but as long as the YAML used to convert to JSON started as JSON, there shouldn't be a problem.
pyyaml provides the option of using the cyaml loader, but I dunno about the dumper.. if you're experiencing delays with reading, try setting Loader=cyaml or whatever.
I can understand the usefulness of things like Krumo[1] for PHP but I am struggling to understand the use-case for this. With a language like PHP you don't have direct manipulation abilities (without debugging using an extension) so it makes sense that you need to format the data before you send it to the client but with JS you have the ability to inspect the JS directly. Also I think JSON (with spaces/indentions/linebreaks) is extremely readable (Especially with things like PrettyPrint[2] installed).
I made it because my app (http://event-fabric.com/) receives arbitrary JSON and one of the options you have is to inspect what is going through the steps, so I need the ability to format arbitrary and possibly nested JSON in a pretty way but without hidding the JSON structure because the app is to actually inspect and manipulate that JSON.
until now I was using a pretty printer but the result was too "technical" for non programmers to see (at least that's my opinion).
It's been baked into http://www.servicestack.net web service fx and lets you see a human readable view of every web service response when called from a browser (i.e. Accept:text/html).
It's also has dynamically sortable table rows and is also completely static/stand-alone. It's just a static template that wraps an embedded JSON response and converting it to HTML on the fly and injecting it the page (all client-side / use view-source).
I was looking this morning at a lib to do this and I couldn't find one, but at one stack overflow question someone posted a screenshot of the ColdFusion tool and I said "that's what I need" and then I decided to do it myself.
nice, I didn't found it this morning when looking for it, maybe since it says prettyprint for javascript it didn't rank high on the search results for my query.
Great work! Would be nice to add an option to convert json key names to human-friendly names(passed as a separate key value array). So a key like full_name can appear as "Your Name:" to the end user.
I've been using a library called prettyprint.js for quite some time that basically does the same thing but a bit prettier and from what I remember is basically a port of sorts of Coldfusion's cfdump: https://github.com/padolsey/prettyPrint.js
I've used this library recently to help the QA's better understand a JSON API's output.
Agreed, Jason.app is really handy for browsing, validating, prettifying, and minifying JSON. I think the outline view is even less friendly for a non-technical person though, listing every value as a name/data-type/value row.
yep, JSON is really readable when indented and colored, but if you need to display it to non technical people something more "tabular" may be a better solution.
[+] [-] k3n|12 years ago|reply
http://jsoneditoronline.org/
Easy to use, and makes working with complex JSON a snap.
The source is also available:
https://github.com/josdejong/jsoneditor/
[+] [-] soljin2000|12 years ago|reply
[+] [-] marianoguerra|12 years ago|reply
in my case I needed a library to use it in a web app.
bookmarked anyway for personal use :)
[+] [-] jere|12 years ago|reply
- Remove quotes from strings. They're already formatted differently.
- Remove array indices.
- Unescape strings.
The context and formatting should still be enough for devs, but I can't imagine quotes or indices do anything for nontechnical people.
e.g. ["\"foo\"","bar"] translates to:
"foo"
bar
[+] [-] marianoguerra|12 years ago|reply
the array indices I was thinking on having it as an option, I would like 'something' to make them standout as lists even when no index is displayed, any idea?
will open issues for both:
* https://github.com/marianoguerra/json.human.js/issues/5
* https://github.com/marianoguerra/json.human.js/issues/6
[+] [-] aaronbrethorst|12 years ago|reply
[+] [-] robmclarty|12 years ago|reply
For me, it's about spacing efficiency (I can see more at once), formatting (e.g., italic is not as easy to read as roman faces), and color (green on grey? huh?).
But I've always been a fan of plain-text in general. I'd much rather use plain-text markdown than MS Word, or edit code in plain files as opposed to an IDE. Plain text, to me, is much more WYSIWIG than any GUI tool I've used. But I understand that not everyone thinks the same way.
[+] [-] r00fus|12 years ago|reply
[+] [-] th0br0|12 years ago|reply
Chrome extension: https://chrome.google.com/webstore/detail/jsonview/chklaanhf...
Original firefox extension: http://benhollis.net/software/jsonview/
[+] [-] marianoguerra|12 years ago|reply
the lib from this article is more tailored for apps that want to display arbitrary json to a broad range of users. As someone asked, there are not many uses, but I have one in my web app (http://event-fabric.com/)
[+] [-] cheald|12 years ago|reply
[+] [-] gumballhead|12 years ago|reply
[+] [-] jenius|12 years ago|reply
[+] [-] chucklarge|12 years ago|reply
[+] [-] napoleond|12 years ago|reply
[+] [-] marianoguerra|12 years ago|reply
the next next step would be to provide in place edition with validation :)
[+] [-] Erwin|12 years ago|reply
[+] [-] kbenson|12 years ago|reply
YAML is a superset of JSON, but as long as the YAML used to convert to JSON started as JSON, there shouldn't be a problem.
[+] [-] meowface|12 years ago|reply
[+] [-] kanzure|12 years ago|reply
[+] [-] joshstrange|12 years ago|reply
Where do you see this being used?
[1] http://krumo.sourceforge.net/
[2] https://chrome.google.com/webstore/detail/prettyprint/nipdlg...
[+] [-] marianoguerra|12 years ago|reply
until now I was using a pretty printer but the result was too "technical" for non programmers to see (at least that's my opinion).
[+] [-] mythz|12 years ago|reply
It's been baked into http://www.servicestack.net web service fx and lets you see a human readable view of every web service response when called from a browser (i.e. Accept:text/html).
It's also has dynamically sortable table rows and is also completely static/stand-alone. It's just a static template that wraps an embedded JSON response and converting it to HTML on the fly and injecting it the page (all client-side / use view-source).
Here's a live preview of it in action: http://servicestack.net/ServiceStack.Northwind/customers/ALF...
And the JSON service it's wrapping: http://servicestack.net/ServiceStack.Northwind/customers/ALF...
[+] [-] BrandonSmith|12 years ago|reply
https://www.google.com/search?q=coldfusion+dump+object&tbm=i...
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0...
[+] [-] marianoguerra|12 years ago|reply
I was looking this morning at a lib to do this and I couldn't find one, but at one stack overflow question someone posted a screenshot of the ColdFusion tool and I said "that's what I need" and then I decided to do it myself.
now someone mentions it here, full circle :D
[+] [-] TeMPOraL|12 years ago|reply
[+] [-] marianoguerra|12 years ago|reply
[+] [-] marianoguerra|12 years ago|reply
[+] [-] badclient|12 years ago|reply
[+] [-] randy_burden|12 years ago|reply
I've used this library recently to help the QA's better understand a JSON API's output.
[+] [-] alessioalex|12 years ago|reply
Edit: treeIt can be used also in Node, has tests written for it and you can customize the HTML template for it.
[+] [-] exizt88|12 years ago|reply
[+] [-] marianoguerra|12 years ago|reply
https://github.com/marianoguerra/json.human.js/issues/1
thanks, didn't know it was a bad practice.
[+] [-] techscruggs|12 years ago|reply
JSON is easy to read, but can get hard to visually parse when the payload is large.
[+] [-] dclowd9901|12 years ago|reply
It's working (not done yet), but I've got an update on my local that I need to iron a bit before I commit.
Oh, and the name sucks.
https://github.com/dclowd9901/lscenery
[+] [-] sdfjkl|12 years ago|reply
[1] https://github.com/tbrannam/Jason
[+] [-] dwich|12 years ago|reply
[+] [-] scrabble|12 years ago|reply
It's funny, I didn't think it would be useful until I actually checked it out, because I personally find JSON to be fairly readable.
[+] [-] astrodust|12 years ago|reply
Maybe I'm not human. Captchas have been telling me this for a while.
[+] [-] marianoguerra|12 years ago|reply
that's the reason for this lib.
thanks for the awesome part :D
[+] [-] capisce|12 years ago|reply
[+] [-] abailin|12 years ago|reply
[+] [-] mjs7231|12 years ago|reply
[+] [-] marianoguerra|12 years ago|reply
happy programmers day! :)