Removing a key from parent object with jq

Using the builtin function del:

$ jq 'del(.pages)' myfile.json
{
  "actions": {
    "pages": {
      "stuff": "..."
    }
  }
}

Try it online at jqplay.org

To remove all pages everywhere, instead of just the outer level, you would use something like

$ jq 'del(.. | .pages?)' myfile.json
{
  "actions": {}
}

Try it online at jqplay.org

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)