Closed wongshung closed 6 months ago
If you have a duplicate like {"name": "Joe", "name": "Sarah"}
, the classic version of the JSON editor would always give you the last version, in this case "name": "Sarah"
. It would silently throw away the first. I think throwing away data is not a good default behavior, and duplicates should be solved by the user instead.
When there is a duplicate key but both hold the same value, there is not actually a conflict and we could solve that without trowing an error. That's a good idea, I'll implement that.
Right now the editor shows the option to Auto Repair JSON with duplicate keys, so you can click "Auto Repair" followed by "Format" to get things done. I have the idea that this is not a common issue, so I'm in doubt whether it is worth spending efforts to improve on this. I'll close this issue now, but feel free to reopen if needed.
O wait, this actually works already 😂 , at least with the lossless-json
parser.
When there is a duplicate key in json, now it could not automatically remove one key on clicking "Format JSON". In previous classic version of json editor, it is fine to do that. I think it should be a better feature to just automatically repair the duplicate key, especially when key and value are exactly the same.