Help us understand the problem. What is going on with this article?

#jq コマンドは #JSON 的には不正な、フラットなオブジェクトの連続も解釈してくれるっぽい

More than 1 year has passed since last update.

invalid JSON

配列の中にあるわけでもなく、フラットな構造でオブジェクトが並んでいるもの。

{ "alice": "liddel"}
{ "bob": "jobs" }

JSON 自体でこの構造が許容されているのかと思いきや、どうやら不正らしい。

image

https://jsonformatter.curiousconcept.com/

jq

$ echo '{ "alice": "liddel"} { "bob": "jobs" }' | jq .
{
  "alice": "liddel"
}
{
  "bob": "jobs"
}
  • 解釈してくれる。
  • おそらく正規のJSONを二回に分けて解釈したという扱いかと思われる。
  • え、ドキュメント読みなさいって?はい、そうですよね。

Original by Github issue

https://github.com/YumaInaura/YumaInaura/issues/978

YumaInaura
Ruby on Rails 業務経験 約5年 / Perl PHP Python Golang Linux Apache MySQL BigQuery Jenkins ansible AWS など / いなうらゆうま / YumaInaura / 稲浦悠馬
http://twitter.com/yumainaura
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした