Parse wrong property value from object type have property null value to IAcctionResult

96 Views Asked by At

I have a model like this:

 public class ObjectA
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public string Description { get; set; }
        public object OtherData { get; set; }
    }

And the JSON data for the same:

 {
        "id" : 12 ,
        "name": "Ababa",
        "description": "data Des",
        "otherData": {
          "signTime":null,
          "objectId":129,
          "confirmStatus": null,
          "note": "nothing"
        }
    }

I receive this data and using JsonConvert.Deserializer by Newtonsoft.Json provider parse this JSON content to my object, but after I return data type IAcctionResult at controller values of them, it has become like this:

 {
        "id" : 12 ,
        "name": "Ababa",
        "description": "data Des",
        "otherData": {
          "signTime":[],
          "objectId":[],
          "confirmStatus": [],
          "note": []
        }
    }

Where was my code wrong?

My result is expected to receive JSON data (not the way using parse otherData to a string).

0

There are 0 best solutions below