導航目錄:
一:Newtonsoft.Json 支持序列化與反序列化的.net 對象類型;
二:C#對象、集合、DataTable與Json內容互轉示例;
Json.net 序列化程序會將.Net 值轉換為json值,表格中是支持轉換的對象類型;
| .net 對象類型 |
轉換后的Json 類型 |
| IList, IEnumerable, IList<T>, Array,datatable |
json數組 |
| IDictionary, IDictionary<TKey, TValue> |
json對象 |
| Object (more detail below) |
json對象 |
Json數組教程:http://www.runoob.com/json/js-json-arrays.html
Json 對象教程:http://www.runoob.com/json/js-json-objects.html
| .net 屬性類型 |
轉換后的Json類型 |
| String |
String |
| Byte、sbyte、uint16、uint32、int32、uint64、int64 |
Integer |
| Float、double、decimal |
Float |
| Enum |
Integer (參考:https://www.newtonsoft.com/json/help/html/T_Newtonsoft_Json_Converters_StringEnumConverter.htm) |
| Datetime |
String(可以格式化字符串參考https://www.newtonsoft.com/json/help/html/DatesInJSON.htm) |
| Byte[] |
string |
| Type |
String(類型名稱) |
| Guid |
string |
| typeConverter |
string |
