TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Json.human.js: Json Formatting for Human Beings

155 点作者 marianoguerra超过 11 年前

25 条评论

k3n超过 11 年前
I use this almost daily, lets you easily format&#x2F;compact and edit JSON through a GUI:<p><a href="http://jsoneditoronline.org/" rel="nofollow">http:&#x2F;&#x2F;jsoneditoronline.org&#x2F;</a><p>Easy to use, and makes working with complex JSON a snap.<p>The source is also available:<p><a href="https://github.com/josdejong/jsoneditor/" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;josdejong&#x2F;jsoneditor&#x2F;</a>
评论 #6382123 未加载
评论 #6380813 未加载
jere超过 11 年前
Pretty funny considering JSON is self described as &quot;easy for humans to read and write.&quot; If your target is nontechnical folks, I wonder if it would be useful to go a step further and:<p>- Remove quotes from strings. They&#x27;re already formatted differently.<p>- Remove array indices.<p>- Unescape strings.<p>The context and formatting should still be enough for devs, but I can&#x27;t imagine quotes or indices do anything for nontechnical people.<p>e.g. [&quot;\&quot;foo\&quot;&quot;,&quot;bar&quot;] translates to:<p><i>&quot;foo&quot;</i><p><i>bar</i>
评论 #6381411 未加载
aaronbrethorst超过 11 年前
You know, it&#x27;s funny but I find the pretty-printed JSON easier to read than the formatted HTML.
评论 #6381904 未加载
评论 #6382218 未加载
th0br0超过 11 年前
I really enjoy JSONView for solving this problem.<p>Chrome extension: <a href="https://chrome.google.com/webstore/detail/jsonview/chklaanhfefbnpoihckbnefhakgolnmc/" rel="nofollow">https:&#x2F;&#x2F;chrome.google.com&#x2F;webstore&#x2F;detail&#x2F;jsonview&#x2F;chklaanhf...</a><p>Original firefox extension: <a href="http://benhollis.net/software/jsonview/" rel="nofollow">http:&#x2F;&#x2F;benhollis.net&#x2F;software&#x2F;jsonview&#x2F;</a>
评论 #6380953 未加载
评论 #6381818 未加载
评论 #6383230 未加载
评论 #6380920 未加载
评论 #6381615 未加载
napoleond超过 11 年前
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).
评论 #6380730 未加载
Erwin超过 11 年前
I dump my JSON as YAML. Even if you are not using YAML for saving data (and I don&#x27;t -- in Python at least PyYAML is orders of magnitudes slower than the built-in JSON), it is nicer to read.
评论 #6381921 未加载
评论 #6382657 未加载
评论 #6384012 未加载
joshstrange超过 11 年前
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&#x27;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&#x2F;indentions&#x2F;linebreaks) is extremely readable (Especially with things like PrettyPrint[2] installed).<p>Where do you see this being used?<p>[1] <a href="http://krumo.sourceforge.net/" rel="nofollow">http:&#x2F;&#x2F;krumo.sourceforge.net&#x2F;</a><p>[2] <a href="https://chrome.google.com/webstore/detail/prettyprint/nipdlgebaanapcphbcidpmmmkcecpkhg?hl=en" rel="nofollow">https:&#x2F;&#x2F;chrome.google.com&#x2F;webstore&#x2F;detail&#x2F;prettyprint&#x2F;nipdlg...</a>
评论 #6380777 未加载
mythz超过 11 年前
I did something similar a few years ago with the HTML5 JSON Report Format: <a href="https://github.com/ServiceStack/ServiceStack/wiki/HTML5ReportFormat" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ServiceStack&#x2F;ServiceStack&#x2F;wiki&#x2F;HTML5Repor...</a><p>It&#x27;s been baked into <a href="http://www.servicestack.net" rel="nofollow">http:&#x2F;&#x2F;www.servicestack.net</a> 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&#x2F;html).<p>It&#x27;s also has dynamically sortable table rows and is also completely static&#x2F;stand-alone. It&#x27;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 &#x2F; use view-source).<p>Here&#x27;s a live preview of it in action: <a href="http://servicestack.net/ServiceStack.Northwind/customers/ALFKI" rel="nofollow">http:&#x2F;&#x2F;servicestack.net&#x2F;ServiceStack.Northwind&#x2F;customers&#x2F;ALF...</a><p>And the JSON service it&#x27;s wrapping: <a href="http://servicestack.net/ServiceStack.Northwind/customers/ALFKI?format=json" rel="nofollow">http:&#x2F;&#x2F;servicestack.net&#x2F;ServiceStack.Northwind&#x2F;customers&#x2F;ALF...</a>
BrandonSmith超过 11 年前
This reminds me of ColdFusion&#x27;s cfdump:<p><a href="https://www.google.com/search?q=coldfusion+dump+object&amp;tbm=isch" rel="nofollow">https:&#x2F;&#x2F;www.google.com&#x2F;search?q=coldfusion+dump+object&amp;tbm=i...</a><p><a href="http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7ef7.html" rel="nofollow">http:&#x2F;&#x2F;help.adobe.com&#x2F;en_US&#x2F;ColdFusion&#x2F;9.0&#x2F;CFMLRef&#x2F;WSc3ff6d0...</a>
评论 #6380982 未加载
TeMPOraL超过 11 年前
I use <a href="http://james.padolsey.com/javascript/prettyprint-for-javascript/" rel="nofollow">http:&#x2F;&#x2F;james.padolsey.com&#x2F;javascript&#x2F;prettyprint-for-javascr...</a> at work in a debugging interface for AJAX requests. Sometimes having JSON pretty-printed in the sidebar is more convenient than clicking on it to expand it in the console.
评论 #6381701 未加载
marianoguerra超过 11 年前
author here: let me know if you have any questions
评论 #6380758 未加载
randy_burden超过 11 年前
I&#x27;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&#x27;s cfdump: <a href="https://github.com/padolsey/prettyPrint.js" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;padolsey&#x2F;prettyPrint.js</a><p>I&#x27;ve used this library recently to help the QA&#x27;s better understand a JSON API&#x27;s output.
alessioalex超过 11 年前
It&#x27;s the same idea as treeIt, a script I made a while ago: <a href="https://github.com/alessioalex/treeIt" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;alessioalex&#x2F;treeIt</a><p>Edit: treeIt can be used also in Node, has tests written for it and you can customize the HTML template for it.
exizt88超过 11 年前
Don&#x27;t use zebra coloring on tables. Edward Tufte strongly advises against this; see <a href="http://www.edwardtufte.com/bboard/q-and-a-fetch-msg?msg_id=0001IV" rel="nofollow">http:&#x2F;&#x2F;www.edwardtufte.com&#x2F;bboard&#x2F;q-and-a-fetch-msg?msg_id=0...</a> esp.
评论 #6380799 未加载
techscruggs超过 11 年前
This would be a fantastic option for the admin interface&#x27;s of JSON document stores like CouchBase, ElasticSearch or RethinkDB.<p>JSON is easy to read, but can get hard to visually parse when the payload is large.
评论 #6382908 未加载
sdfjkl超过 11 年前
I&#x27;m using Jason.app[1] on OS X which does this wonderfully (as desktop app).<p>[1] <a href="https://github.com/tbrannam/Jason" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tbrannam&#x2F;Jason</a>
评论 #6382353 未加载
scrabble超过 11 年前
This is awesome.<p>It&#x27;s funny, I didn&#x27;t think it would be useful until I actually checked it out, because I personally find JSON to be fairly readable.
评论 #6381432 未加载
评论 #6380963 未加载
capisce超过 11 年前
Or just use QML: <a href="http://en.wikipedia.org/wiki/QML#Basic_syntax" rel="nofollow">http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;QML#Basic_syntax</a>
abailin超过 11 年前
My go to JSON viewer continues to be <a href="http://json.parser.online.fr" rel="nofollow">http:&#x2F;&#x2F;json.parser.online.fr</a>
mjs7231超过 11 年前
I find the the input format much easier to mentally parse, and it&#x27;s more compact too. Maybe I am not human.
评论 #6380993 未加载
boyander超过 11 年前
That&#x27;s funny because JSON is enough readable by itself. My life has changed a lot.
marknutter超过 11 年前
Should have called it humon.js. Missed opportunity.
duiker101超过 11 年前
I actually find easier to read raw json....
debacle超过 11 年前
s&#x2F;loosing&#x2F;losing&#x2F;
评论 #6380786 未加载
dotpot超过 11 年前
for me it&#x27;s more easier to read json than html formatted one.