Deserializing JSON data to C# using JSON.NET

前端 未结 7 1727
离开以前
离开以前 2020-11-22 04:01

I\'m relatively new to working with C# and JSON data and am seeking guidance. I\'m using C# 3.0, with .NET3.5SP1, and JSON.NET 3.5r6.

I have a defined C# class that

7条回答
  •  鱼传尺愫
    2020-11-22 04:53

    You can use:

    JsonConvert.PopulateObject(json, obj);
    

    here: json is the json string,obj is the target object. See: example

    Note: PopulateObject() will not erase obj's list data, after Populate(), obj's list member will contains its original data and data from json string

提交回复
热议问题