I want to delete some keys and its values in a nested json file on windows in a shell .cmd script, but get errors.Looks like a quoting issue and more.
Input file:
{"account_tracker_service_last_update": "13351819478658924","alternate_error_pages": {"backup": true,"enabled": false },"announcement_notification_service_first_run_time": "13272713839385778","autocomplete": {"retention_policy_last_version": 120 },"browser": {"app_window_placement": {"DevToolsApp": {"always_on_top": false,"work_area_top": 0 } },"clear_data": {"time_period": 4 },"last_clear_browsing_data_tab": 1 }}
I want to remove some more keys but started with just one: alternate_error_pages
Tried jq-win64.exe "del[\".alternate_error_pages\"]" example.json
and got:
jq: error: del/0 is not defined at , line 1:del[".alternate_error_pages"]jq: 1 compile error
Next: jq-win64.exe "del(.name=\"alternate_error_pages\")" example.json
but get:
jq: error (at example.json:23): Invalid path expression with result {"account_tracker_service_...
I tried a few more things but these are gone from my script already.
What I really want to achieve is to remove these keys:
.alternate_error_pages.autocomplete.browser.app_window_placement.DevToolsApp
But I did not manage to remove one single top level key.