access inner object during JSON.stringify replacer

Viewed 19

I have this JSON structure

obj = {
 "id": {
    "id": "secret",
    "one": "val"
  },
  "two": "val"
}

I want to mask the value of id.id in JSON.stringify() using replacer.

"{"id": { "id": "masked", "first": "val"}, "second": "val"}"

how do I get hold of key = id.id or the holder inner object for inner object's serialization.

0 Answers
Related