1

I've been doing some testing on my API in postman and noticed that when there are duplicate keys, the last duplicated value will be carried over in my request body. Is there a way in Spring / Spring boot to prevent getting the duplicate value? Or is there something already built in Spring to strengthen this security issue?

{
    "firstName": "Miguel",

    "firstName": "Xavier",

    "isBirthdayToday": false
}

i.e. Xavier will be in my request body instead of Miguel.

dur
  • 15,689
  • 25
  • 79
  • 125
milo
  • 13
  • 4
  • you can configure Jackson to throw exception if duplicate value is detected, take a look here: https://stackoverflow.com/questions/37152629/how-to-use-jackson-to-validate-duplicated-properties/37153217#37153217 or here: https://stackoverflow.com/questions/23781637/jackson-detection-of-duplicate-json-pojo-properties-and-map-keys – Andrei Titov Aug 26 '22 at 17:02

0 Answers0