AlexTeixeira / Askmethat-Aspnet-JsonLocalizer

Json Localizer library for .NetStandard and .NetCore Asp.net projects
MIT License
91 stars 29 forks source link

Error on binding models for error message using data annotation #113

Closed matesols closed 2 years ago

matesols commented 3 years ago

When I try to bind model for error message, it gives the following error

An unhandled exception occurred while processing the request. JsonSerializationException: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'System.Collections.Concurrent.ConcurrentDictionary`2[System.String,Askmethat.Aspnet.JsonLocalizer.Format.JsonLocalizationFormat]' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly. To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array. Path '', line 1, position 1. Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureArrayContract(JsonReader reader, Type objectType, JsonContract contract)

image

AlexTeixeira commented 3 years ago

Hi,

Can you share a sample of your JSON File and the plugin configuration ?