Use jq to parse a JSON String

北战南征 提交于 2019-11-29 00:51:06

jq has the fromjson builtin for this:

jq '.c | fromjson | .id' myFile.json

fromjson was added in version 1.4.

Casimir et Hippolyte

You can use the raw output (-r) that will unescape characters:

jq -r .c myfile.json | jq .id

ADDENDUM: This has the advantage that it works in jq 1.3 and up; indeed, it should work in every version of jq that has the -r option.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!