go-json-experiment / json

Experimental implementation of a proposed v2 encoding/json package
BSD 3-Clause "New" or "Revised" License
341 stars 11 forks source link

provide structured error to detect duplicate names #41

Open ajwerner opened 1 month ago

ajwerner commented 1 month ago

In some cases, the user may want to detect duplicate names when decoding and fall back to trying again with the AllowDuplicateNames options. The stack pointers are relatively worthless when duplicate names are enabled, but at least you can succeed.

There is a TODO to clean up the errors, but just want to track my use case specifically.

This issue also means that I'm requesting that SyntacticError potentially have an Unwrap method.

ChrisHines commented 1 month ago

Thanks. I requested the same thing during the design process and I believe it is agreed we need it.