JQ

    Select the elements where an attribute is equal to a value

    jq '.[] | select(.location=="Stockholm")' json
    

    Select the elements with a regex

    jq '.[] | select(.location|test("Sto.+olm"))
    

    Count elements in array

    jq '. | length'
    

    Source

    Delete long arrays

    Help to get headers, and clear the infos

    jq 'del(.data.long_array[]?)' json_file
    

    Select multiple fields

    jq '.[] | .login, .id'
    

    source

    Select based on key entries

    echo '{"key1":{"o1": "v1"},"key2":{"o2":"v2"}}' | jq 'with_entries(select(.key == "key2"))'
    {
      "key2": {
        "o2": "v2"
      }
    }
    
    

    Unique elements

    echo '[{"o1": "v1"},{"o1":"v1"},{"o1":"v2"}]' | jq '[.[].o1] | unique'
    [
      "v1",
      "v2"
    ]
    

    Replace and/or transform a value

    echo '[{"o1": "1"},{"o1":"2"},{"o1":"3","o2":"untouched"}]' | jq '.[].o1 |= (. | tonumber + 100)'
    [
      {
        "o1": 101
      },
      {
        "o1": 102
      },
      {
        "o1": 103,
        "o2": "untouched"
      }
    ]
    
    

    Looking for paths containing a value

    i3-msg -t get_tree | jq '[paths as $path | select(getpath($path) == "spotify") | $path | ".\(map("[\(tojson)]") | join(""))"]'
    [
      ".[\"nodes\"][1][\"nodes\"][1][\"nodes\"][3][\"nodes\"][0][\"marks\"][0]",
      ".[\"nodes\"][1][\"nodes\"][1][\"nodes\"][3][\"nodes\"][0][\"window_properties\"][\"instance\"]"
    ]
    

    source