I have data structure similar like this
{"id": 1, "a": [{"id": 2, "b": [{"id": 3, "c": [{"id": 4}]}]}]}
I would like to change every id to null.
I know I could do loops and manually assign null to id. Is there any easy way to do this in JavaScript?
JSON.parse(JSON.stringify(x),(k,v)=>k==='id'?null:v);- of course, this doesn't mutate the original - but you didn't specify if you wanted to mutate in place or not