Use direct derivativeization to convert JSON to C# datatable
Considering the following format JSON:
<code>[ {"id":"10","name":"User","add":false,"edit":true,"authorize":true,"view":true}, {"id":"11","name":"Group","add":true,"edit":false,"authorize":false,"view":true}, {"id":"12","name":"Permission","add":true,"edit":true,"authorize":true,"view":true} ]</code>
<code class="language-csharp">using Newtonsoft.Json; // 假设 JSON 存储在名为 'json' 的字符串变量中 DataTable dt = (DataTable)JsonConvert.DeserializeObject(json, (typeof(DataTable)));</code>
The above is the detailed content of How to Directly Deserialize JSON into a C# DataTable?. For more information, please follow other related articles on the PHP Chinese website!