1. 程式人生 > >一:Newtonsoft.Json 支援序列化與反序列化的.net 物件型別;

一:Newtonsoft.Json 支援序列化與反序列化的.net 物件型別;

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