Only works on the Public visible type. (使用.NET系统环境之中自带的框架进行JSON序列化和反序列化)
JsonContract
01 Syntax
02 Methods
| Name | Overloads | Summary |
|---|---|---|
| MatrixJson | 1 | Create json text for array matrix. |
| GetObjectJson | 2 | |
| writeJson | 1 | Write json with setting configuration |
| WriteLargeJson | 1 | 将目标对象保存为json文件 |
| RemoveJsonNullItems | 1 | 有些javascript程序(例如highcharts.js)要求json里面不可以出现null的属性,可以使用这个方法进行移除 |
| GetJson | 1 | Gets the json text value of the target object, the attribute ScriptIgnoreAttribute can be used for block the property which is will not serialize to the text. |
| LoadObject | 2 | Create object instance from a given json text base on the template Type information. |
| LoadJSON | 1 | 从文本文件或者文本内容之中进行JSON反序列化 |
| LoadObject | 1 | XML CDATA to json |
| LoadJSONL | 2 | load json list file |
| LoadJsonFile | 1 | Create object instance from a json text of a given text file. |
| WriteLargeJson | 1 | |
| GetJson | 1 | |
| LoadJSONObject | 1 | |
| LoadJSON | 1 | |
| LoadJSONL | 1 | |
| LoadJsonFile | 1 | |
| EnsureDate | 1 |
03 Members
Double()())Create json text for array matrix.
| Name | Type | Description |
|---|---|---|
matrix | Double()() | - |
Type, Object, Boolean, Boolean, IEnumerable(Of Type))使用ScriptIgnoreAttribute来屏蔽掉不想序列化的属性
| Name | Type | Description |
|---|---|---|
obj | Type | - |
type | Object | - |
Stream, Object, Type, Boolean, IEnumerable(Of Type))Write json with setting configuration
| Name | Type | Description |
|---|---|---|
output | Stream | - |
obj | Object | - |
type | Type | - |
simpleDict | Boolean | - |
knownTypes | IEnumerable(Of Type) | - |
``0, String, Boolean)将目标对象保存为json文件
| Name | Description |
|---|---|
T |
| Name | Type | Description |
|---|---|---|
obj | ``0 | - |
path | String | - |
String)有些javascript程序(例如highcharts.js)要求json里面不可以出现null的属性,可以使用这个方法进行移除
| Name | Type | Description |
|---|---|---|
json | String | - |
``0, Boolean, Boolean, IEnumerable(Of Type))Gets the json text value of the target object, the attribute ScriptIgnoreAttribute can be used for block the property which is will not serialize to the text.
(使用ScriptIgnoreAttribute来屏蔽掉不想序列化的属性)
2016-11-9 对字典进行序列化的时候,假若对象类型是从字典类型继承而来的,则新的附加属性并不会被序列化,只会序列化字典本身 2018-10-5 不可以序列化匿名类型
| Name | Description |
|---|---|
T |
| Name | Type | Description |
|---|---|---|
obj | ``0 | - |
String, Type, Boolean, Boolean, Exception, IEnumerable(Of Type))Create object instance from a given json text base on the template Type information.
| Name | Type | Description |
|---|---|---|
json | String | parse this json string and then decoded as the required .NET clr object. some special json text mapping: null will be decoded as Nothing |
type | Type | - |
String, Boolean, Boolean, Exception, IEnumerable(Of Type))从文本文件或者文本内容之中进行JSON反序列化
null or empty string will be parsed as nothing if the optional parameter throwEx option value is set to false
| Name | Type | Description |
|---|---|---|
json | String | This string value can be json text or json file path. |
XElement, Boolean)XML CDATA to json
| Name | Description |
|---|---|
T |
| Name | Type | Description |
|---|---|---|
json | XElement | - |
simpleDict | Boolean | - |
String, Encoding, Boolean, IEnumerable(Of Type), Boolean)load json list file
| Name | Description |
|---|---|
T |
| Name | Type | Description |
|---|---|---|
file | String | - |
encoding | Encoding | - |
simpleDict | Boolean | - |
knownTypes | IEnumerable(Of Type) | - |
throwEx | Boolean | - |
IEnumerable(Of String), Encoding, Boolean, IEnumerable(Of Type), Boolean)load json list file
| Name | Description |
|---|---|
T |
| Name | Type | Description |
|---|---|---|
jsonl | IEnumerable(Of String) | the file content of the jsonl file |
encoding | Encoding | - |
simpleDict | Boolean | - |
knownTypes | IEnumerable(Of Type) | - |
throwEx | Boolean | - |
String, Encoding, Boolean, IEnumerable(Of Type), Boolean)Create object instance from a json text of a given text file.
| Name | Description |
|---|---|
T |
| Name | Type | Description |
|---|---|---|
file$ | String | - |
encoding | Encoding | - |
simpleDict | Boolean | - |
Object, Boolean, Boolean, IEnumerable(Of Type))T, String, Boolean)T, Boolean, Boolean, IEnumerable(Of Type))Stream, Type, Boolean)String, Boolean, Boolean, Exception, IEnumerable(Of Type))XElement, Boolean)String, Encoding, Boolean, IEnumerable(Of Type), Boolean)String, Encoding, Boolean, IEnumerable(Of Type), Boolean)String, String)