{"slug": "jq-to-filter-json-by-value", "title": "JQ to filter JSON by value", "summary": "The article explains how to use the `jq` command-line tool to filter JSON data by a specific value. It provides the syntax `cat <filename> | jq -c '.[] | select( .<key> | contains(\"<value>\"))'` and notes that numeric values should not be enclosed in quotes within the `contains()` function. An example filters for records where the `_id` key equals the numeric value 611.", "body_md": "Syntax: cat <filename> | jq -c '.[] | select( .<key> | contains(\"<value>\"))'\nExample: To get json record having _id equal 611\ncat my.json | jq -c '.[] | select( ._id | contains(611))'\nRemember: if JSON value has no double quotes (eg. for numeric) to do not supply in filter i.e. in contains(611)", "url": "https://wpnews.pro/news/jq-to-filter-json-by-value", "canonical_source": "https://gist.github.com/ipbastola/2c955d8bf2e96f9b1077b15f995bdae3", "published_at": "2016-10-24 09:45:02+00:00", "updated_at": "2026-05-22 19:07:05.529441+00:00", "lang": "en", "topics": ["developer-tools", "data"], "entities": [], "alternates": {"html": "https://wpnews.pro/news/jq-to-filter-json-by-value", "markdown": "https://wpnews.pro/news/jq-to-filter-json-by-value.md", "text": "https://wpnews.pro/news/jq-to-filter-json-by-value.txt", "jsonld": "https://wpnews.pro/news/jq-to-filter-json-by-value.jsonld"}}