TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Newline Delimited JSON

47 pointsby xingyztalmost 4 years ago

13 comments

throwaway894345almost 4 years ago
I was wondering how this compared to jsonlines&#x2F;jsonl <a href="https:&#x2F;&#x2F;jsonlines.org" rel="nofollow">https:&#x2F;&#x2F;jsonlines.org</a><p>&gt; This page describes the JSON Lines text format, also called newline-delimited JSON.<p>And then I saw this at the bottom of the ndjson.org page:<p>&gt; Site forked from jsonlines.org<p>So is this a fork of the site only, or a fork of the jsonlines standard?
评论 #27281891 未加载
评论 #27284372 未加载
BugsJustFindMealmost 4 years ago
This is an awful lot of foofaraw to basically say &quot;no newlines in your stream of discrete messages except between messages&quot;. The proposal appears to have absolutely nothing to do with JSON, and the only connection is that their example messages happen to be JSON but could just as easily be anything else.
评论 #27282274 未加载
评论 #27282098 未加载
评论 #27283029 未加载
jmullalmost 4 years ago
Makes sense to me. I&#x27;ve been using this and calling it &quot;jsonlog&quot; format, but now I can switch to a hopefully more standard name.
spullaraalmost 4 years ago
This has been Twitter&#x27;s stream format since they had a stream format for their firehose in probably 2007.
评论 #27282558 未加载
kosolamalmost 4 years ago
Err... Am I the only one that see json objects on multiple lines? And that’s it...
评论 #27283080 未加载
jasonpeacockalmost 4 years ago
And here I am wrapping my results in a result object line a newb:<p><pre><code> { results: [ { ... }, { ... }, { ... } ] }</code></pre>
评论 #27282843 未加载
评论 #27282645 未加载
评论 #27282709 未加载
callesggalmost 4 years ago
I know I have used something like this code before, it is basicly what they are talking about.<p>json_decode(“[“.implode($lines,”,\n”).”]”)
评论 #27282966 未加载
dheeraalmost 4 years ago
Why not just use YAML, which accomplishes effectively the same goals, and already has a decent amount of traction?<p>In general I use YAML for human-edited configuration files, because they generate clean diffs, and JSON for machine-to-machine communication, because of the wealth of obscenely optimized parsnips for every language.
评论 #27283494 未加载
kazinatoralmost 4 years ago
I&#x27;ve done a similar thing with Lisp sometimes: implementing hacks so that a list in a file always looks like this:<p><pre><code> ((lorem ipsum ..) (quorat est demonstrandum ...) ... ...) </code></pre> Only major line-breaks between top-level elements.
tengbretsonalmost 4 years ago
I could be wrong, but isnt the ElasticSearch API implemented like this?
评论 #27283203 未加载
maerF0x0almost 4 years ago
basically json streams? <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;JSON_streaming" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;JSON_streaming</a><p>In my day job we ndjson pretty extensively and it&#x27;s been pretty good to us. It has far better characteristics than passing a giant json array of objects (you have to hit the closing bracket on the array to know if it&#x27;s valid)
monkey26almost 4 years ago
Haven&#x27;t we already been doing this for years? JQ has supported this for a long time as well.
评论 #27282854 未加载
评论 #27283044 未加载
评论 #27283185 未加载
alpbalmost 4 years ago
Why not throw in the inline comments feature to the mix if you&#x27;re gonna end up using a different spec&#x2F;different parser anyway? This is an 8+ year old spec and I don&#x27;t think it has caught much adoption.<p>If you&#x27;re really into hot having commas, maybe you can do a post-processing step with sed or in-memory string replacement to add&#x2F;remove &quot;,&quot; and \n? Then you&#x27;re still getting the same JSON experience under the covers where programs process it?
评论 #27283214 未加载
评论 #27283161 未加载