k-paxian / dart-json-mapper

Serialize / Deserialize Dart Objects to / from JSON
https://pub.dev/packages/dart_json_mapper
Other
400 stars 33 forks source link

Can't deserialize a Json back to JsonSerializable class #170

Closed kobi666 closed 2 years ago

kobi666 commented 2 years ago

Maybe i'm doing something really wrong, and maybe i'm expecting too much of dart as well, but

i'm trying to simply get a class back from a json using JsonMapper.deserialize(json). I keep getting the following error regardless of the json value format (Simple Json string, Map<String,Dynamic>, string with ''' around it)

Instance of 'DeserializationContext' FormatException: Unexpected character (at character 1) then pointing out the first char of the value (not the key)

The class is indeed decorated with @JsonSerializable(name : 'propertyname') , but i'm really failing at seeing what i'm doing wrong.

if there are more steps needed to do this kind of thing, Please let me know. i've gone through the manual without seeing something that could help :\

(i'll be willing to contribute to the documentation if I see my mistake)

k-paxian commented 2 years ago

No worries, please paste here your code snippets you are struggling with, and we'll try to help you out