0

Is it possible to assign a global setting to AddJsonOptions to not allow duplicate values to be passed?

For example, if I send the following JSON I want the JSON not to validate.

{
    "firstName": "Bob",
    "firstName": "Smith",
    "firstName": "Bobby",
}

I'd assumed there would be a setting somewhere in AddJsonOptions somewhere but I can't find anything. I'd be happy to hear if this is possible any other way if not in AddJsonOptions.

Divyang Desai
  • 7,483
  • 13
  • 50
  • 76
user2883072
  • 217
  • 3
  • 12
  • I've found this other similar question that I'll have a look at: https://stackoverflow.com/questions/55154252/how-to-validate-json-request-body-as-valid-json-in-asp-net-core/55161421#55161421 – user2883072 Feb 03 '20 at 10:58
  • I think it does... i found it before you posted but not tried yet... thanks – user2883072 Feb 03 '20 at 11:51
  • Then you should accept the link as a duplicate which will close the question. – DavidG Feb 03 '20 at 11:52

0 Answers0