jzon icon indicating copy to clipboard operation
jzon copied to clipboard

Implement `replacer` equivalent in `stringify`

Open Zulu-Inuoe opened this issue 3 years ago • 1 comments

Using JSON.stringify in JS, there is a replacer function that can be provided. This serves for as a point-of-serialize coercion of values and offers an alternative way to handle the hard problem of coercing to JSON.

I think it'd be a good idea to implement here. For the case of excluding keys, I've settled on the behaviour of

  1. Exclude the field - nil
  2. Include the field - t
  3. Include the field, and use a replacement value (values t "replacement")

Zulu-Inuoe avatar Apr 22 '22 19:04 Zulu-Inuoe

Can this be closed now? If not, what's left?

fstamour avatar May 16 '22 02:05 fstamour

@fstamour congrats I just closed it w/ 923fd268d24d799c6e8b3ea98a92c069fcfeae39 which I think was the last remaining edge-case? There might be some other weird case but future people will have to deal with it

Zulu-Inuoe avatar Jan 27 '23 23:01 Zulu-Inuoe