Linux Command line JSON parsing tool--jq__ database

Source: Internet
Author: User

JQ Basic use can refer to this article:
http://blog.chinaunix.net/uid-24774106-id-3830242.html
JQ English document please refer to:
http:// stedolan.github.io/jq/manual/
=================================================================
Basic format:
JQ [parameter list]   ' filter condition ' filename or standard input
Example:
jq-c '. Foo ' A.json
or:
Cat A.json | jq-c '. Foo '

=================================================================
Parameter description:
--compact-output/C
By default, JQ formats JSON as a multiline tree output, but sometimes you need to output a JSON string in one row to use this parameter
=================================================================
Filter Description:
. foo,. Foo.bar
Gets the value of the key in JSON to filter out the key value in the multilevel JSON string.
. foo,. Bar
Gets the value of more than one key in JSON at the same time. However, more than one value filtered out will be displayed on multiple lines.
{foo:. Foo, bar:. Bar}
Gets the value of some key in JSON and combines it with a new object-form JSON string. Foo and Bar are the key,.foo of the new JSON string and the. Bar is the key that needs to get the value in the original JSON string.
Note that the generated JSON string is in reverse order, which is generated in the example: {"bar": "", "foo": ""}
[. Foo,. Bar]
Gets the value of some key in JSON and combines it with a new array of JSON strings.. foo and. Bar is the key that needs to get the value in the original JSON string.
Note that the generated JSON string content order is positive, which is generated in the example: ["Foov", "Barv"]


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.