-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Json deserializer List<string> #28
Comments
Darn, I thought this worked. It's nothing you're doing wrong. Handling for this case needs to be added. |
This bug seems to affect IList of any value types. I am running into the same problem serializing this array into a List: [14877833,13434092,88344083]. The result is a list of 3 longs. Also, if I serialize as a List, I get a null value. |
If anyone is looking for a quick and dirty fix for this issue I pieced together (read copy/paste) a deserializer based of the existing one - http://gist.github.com/485545. Testing on it is pretty minimal but it worked for the simple stuff I used it for. |
I'm almost done with a fix for this as well. Should be committed in the next few days. |
fixed! |
Same problem exists for XML deserializer List<string>. My hotfix for this is:
|
It still happens for user-created types, i've found a solution: in JsonDeserializer.cs replace instance = Activator.CreateInstance(type); with instance = System.Runtime.Serialization.FormatterServices.GetUninitializedObject(type); and thats all :) |
I am trying to deserialize a the json:
"types": [ "locality", "political" ]
Into a List. Attempting to do so throws - System.MissingMethodException: No parameterless constructor defined for this object.
Not sure if this is a bug or I am just doing it wrong.
The text was updated successfully, but these errors were encountered: