Gson does not detect duplicate keys in the nested json
Open
enhancement
- Dominant language
- Java
- Stars
- 24.2k
- Forks
- 4.5k
- Avg merge
- 6d 4h
- Merged PRs (30d)
- 12
Description
Gson is unable detect duplicate keys in the nested json
See below code snippet
```
public static void main(String[] args) throws IOException {
Map map;
//this does not detect duplicate 'key'
map = new Gson().fromJson("{'a':'x','aa':{'key':'x','key':'y'}}", Map.class);
//As expected , this call fails with Exception in thread "main" com.google.gson.JsonSyntaxException: duplicate key: a
map = new Gson().fromJson("{'a':'x','a':'y'}", Map.class);
}
```
Is this the expected behavior ?
If so is there any alternative to fail in the first case as well?
Contributor guide
Assessment
This issue has not been assessed yet.