You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure how to properly explain the issue i have, so i'm gonna type an example.
I have a generic json response, that i break it down to a class using JsonMapper.ToObject<Response>(response)
public class Response{
public JsonData data {get; set;},
public int status {get; set;}
}
After this class, data can break down to different types of objects depending on the response.
And i want to be able to map it again with: JsonMapper.ToObject<MyClass>(myResponse.data.ToJson())
The issue here is that if within JsonData there was an empty object or an empty array, the property is corrupted and instead being like this: "array" : [], it is like this: "array" : and i get a KeyNotFoundException.
Is there any workaround for this? Am i doing something wrong?
The text was updated successfully, but these errors were encountered:
discordgr
changed the title
JsonData corrupts empty objects & arrays when used inside JsonMapper.ToObject
JsonData corrupts empty objects & arrays
Mar 8, 2022
discordgr
changed the title
JsonData corrupts empty objects & arrays
JsonData corrupts empty objects & arrays
Mar 8, 2022
I'm not sure how to properly explain the issue i have, so i'm gonna type an example.
I have a generic json response, that i break it down to a class using
JsonMapper.ToObject<Response>(response)
After this class, data can break down to different types of objects depending on the response.
And i want to be able to map it again with:
JsonMapper.ToObject<MyClass>(myResponse.data.ToJson())
The issue here is that if within JsonData there was an empty object or an empty array, the property is corrupted and instead being like this: "array" : [], it is like this: "array" : and i get a KeyNotFoundException.
Is there any workaround for this? Am i doing something wrong?
The text was updated successfully, but these errors were encountered: