JSON.NET deserialize/serialize JsonProperty JsonObject

前端 未结 2 1433
名媛妹妹
名媛妹妹 2021-01-13 01:35

I have a question for deserialize/serialize with the Newtonsoft JSON.NET library:

I receive this json :

 {
    \"customerName\" : \"Lorem\",
    \"id         


        
2条回答
  •  悲哀的现实
    2021-01-13 02:11

    One possible solution you could use, which might look a bit hacky, would be to manipulate the JSON string before parsing it, using a regex for example.

    You would identify and replace

    "attribute" : {
       "nbrOfUse" : 1,
       "lastUse" : "2013-01-03T09:57:28-0500"
     }
    

    with

    "lastUse" : "2013-01-03T09:57:28-0500"
    

    Then, your serializer would identify a DateTime? property named "lastUsed"

提交回复
热议问题