You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Although it would be nice to have more general support for ensuring that incoming JSON has no duplicate keys, one thing that is much easier to do is to add such checks as part of Tree building.
That is: whenever using data-binding to read JSON trees (mapper.readTree(), or readValue(JsonNode.class)), it would be possible to throw a JsonMappingException if same key is seen second time. Check should be cheap as well; and we could then point to two-step conversion (JSON to tree, tree to POJO) as one way to validate that no duplicate keys are coming in.
is the related issue for doing the same at lower level, at JsonParser. The problem there is the additional cost of managing key sets; with tree model we have to keep track of that anyway.
The text was updated successfully, but these errors were encountered:
Although it would be nice to have more general support for ensuring that incoming JSON has no duplicate keys, one thing that is much easier to do is to add such checks as part of Tree building.
That is: whenever using data-binding to read JSON trees (mapper.readTree(), or readValue(JsonNode.class)), it would be possible to throw a
JsonMappingException
if same key is seen second time. Check should be cheap as well; and we could then point to two-step conversion (JSON to tree, tree to POJO) as one way to validate that no duplicate keys are coming in.For sake of completeness, here: FasterXML/jackson-core#60
is the related issue for doing the same at lower level, at
JsonParser
. The problem there is the additional cost of managing key sets; with tree model we have to keep track of that anyway.The text was updated successfully, but these errors were encountered: