3

这是我的json:

[
 {
  "ReferringUrl": "N",
  "OpenAccess": "0",
  "ItmId": "1694738780"
 },
 {
  "ReferringUrl": "L",
  "OpenAccess": "1",
  "ItmId": "1347809133"
 }
]

我希望它恢复为原始的 json 格式:

[{"ReferringUrl": "N","OpenAccess": "0","ItmId": "1694738780"},{"ReferringUrl": "L","OpenAccess": "1","ItmId": "1347809133"}]

如何使用 jq 来做到这一点?:) 谢谢!

4

1 回答 1

9

只需使用--compact-output/-c选项:

cat file | jq -c

(或者,没有猫虐待jq -c '.' file:)

于 2017-06-29T13:39:21.983 回答