summaryrefslogtreecommitdiff
path: root/node_dump.c
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2025-08-23 19:57:14 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2025-08-27 10:01:52 +0900
commitd9e9a667a8c8fb6f57611c68b45eaf1f2c39fca1 (patch)
tree3ac8241bb5b0bc69574d2496324e0ec14a730731 /node_dump.c
parent0e0f0dfd070fc156ec74c58f44d86a884a0580e0 (diff)
JSON.generate: warn or raise on duplicated key
Because both strings and symbols keys are serialized the same, it always has been possible to generate documents with duplicated keys: ```ruby >> puts JSON.generate({ foo: 1, "foo" => 2 }) {"foo":1,"foo":2} ``` This is pretty much always a mistake and can cause various issues because it's not guaranteed how various JSON parsers will handle this. Until now I didn't think it was possible to catch such case without tanking performance, hence why I only made the parser more strict. But I finally found a way to check for duplicated keys cheaply enough.
Diffstat (limited to 'node_dump.c')
0 files changed, 0 insertions, 0 deletions