Class JSONReader
Provides deserialization functionality from JSON format
Inheritance
System.Object
JSONReader
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: Azos.dll
Syntax
public static class JSONReader
Methods
DeserializeDataObject(ISourceText, Boolean)
Declaration
public static IJSONDataObject DeserializeDataObject(ISourceText source, bool caseSensitiveMaps = true)
Parameters
Type |
Name |
Description |
ISourceText |
source |
|
System.Boolean |
caseSensitiveMaps |
|
Returns
DeserializeDataObject(Stream, Encoding, Boolean)
Declaration
public static IJSONDataObject DeserializeDataObject(Stream stream, Encoding encoding = null, bool caseSensitiveMaps = true)
Parameters
Type |
Name |
Description |
System.IO.Stream |
stream |
|
System.Text.Encoding |
encoding |
|
System.Boolean |
caseSensitiveMaps |
|
Returns
DeserializeDataObject(String, Boolean)
Declaration
public static IJSONDataObject DeserializeDataObject(string source, bool caseSensitiveMaps = true)
Parameters
Type |
Name |
Description |
System.String |
source |
|
System.Boolean |
caseSensitiveMaps |
|
Returns
DeserializeDataObjectFromFile(String, Encoding, Boolean)
Declaration
public static IJSONDataObject DeserializeDataObjectFromFile(string filePath, Encoding encoding = null, bool caseSensitiveMaps = true)
Parameters
Type |
Name |
Description |
System.String |
filePath |
|
System.Text.Encoding |
encoding |
|
System.Boolean |
caseSensitiveMaps |
|
Returns
DeserializeDynamic(ISourceText, Boolean)
Declaration
public static dynamic DeserializeDynamic(ISourceText source, bool caseSensitiveMaps = true)
Parameters
Type |
Name |
Description |
ISourceText |
source |
|
System.Boolean |
caseSensitiveMaps |
|
Returns
Type |
Description |
System.Object |
|
DeserializeDynamic(Stream, Encoding, Boolean)
Declaration
public static dynamic DeserializeDynamic(Stream stream, Encoding encoding = null, bool caseSensitiveMaps = true)
Parameters
Type |
Name |
Description |
System.IO.Stream |
stream |
|
System.Text.Encoding |
encoding |
|
System.Boolean |
caseSensitiveMaps |
|
Returns
Type |
Description |
System.Object |
|
DeserializeDynamic(String, Boolean)
Declaration
public static dynamic DeserializeDynamic(string source, bool caseSensitiveMaps = true)
Parameters
Type |
Name |
Description |
System.String |
source |
|
System.Boolean |
caseSensitiveMaps |
|
Returns
Type |
Description |
System.Object |
|
ToDoc(Doc, JSONDataMap, Boolean, Nullable<JSONReader.NameBinding>)
Converts JSONMap into supplied row instance.
The extra data found in JSON map will be placed in AmorphousData dictionary if the row implemets IAmorphousData, discarded otherwise.
Note: This method provides "the best match" and does not guarantee that all data will/can be converted from JSON, i.e.
it can only convert one dimensional arrays and Lists of either primitive or TypeRow-derived entries
Declaration
public static void ToDoc(Doc doc, JSONDataMap jsonMap, bool fromUI = true, JSONReader.NameBinding? nameBinding = default(JSONReader.NameBinding? ))
Parameters
Type |
Name |
Description |
Doc |
doc |
Data document instance to convert into
|
JSONDataMap |
jsonMap |
JSON data to convert into row
|
System.Boolean |
fromUI |
When true indicates that data came from UI, hence NonUI-marked fields should be skipped. True by default
|
System.Nullable<JSONReader.NameBinding> |
nameBinding |
Used for backend name matching or null (any target)
|
ToDoc(Type, JSONDataMap, Boolean, Nullable<JSONReader.NameBinding>)
Converts JSONMap into typed data document of the requested type.
The requested type must be derived from Azos.Data.TypedDoc.
The extra data found in JSON map will be placed in AmorphousData dictionary if the row implemets IAmorphousData, discarded otherwise.
Note: This method provides "the best match" and does not guarantee that all data will/can be converted from JSON, i.e.
it can only convert one dimensional arrays and Lists of either primitive or TypeRow-derived entries
Declaration
public static TypedDoc ToDoc(Type type, JSONDataMap jsonMap, bool fromUI = true, JSONReader.NameBinding? nameBinding = default(JSONReader.NameBinding? ))
Parameters
Type |
Name |
Description |
System.Type |
type |
TypedDoc subtype to convert into
|
JSONDataMap |
jsonMap |
JSON data to convert into data doc
|
System.Boolean |
fromUI |
When true indicates that data came from UI, hence NonUI-marked fields should be skipped. True by default
|
System.Nullable<JSONReader.NameBinding> |
nameBinding |
Used for backend name matching or null (any target)
|
Returns
ToRow<T>(JSONDataMap, Boolean, Nullable<JSONReader.NameBinding>)
Generic version of ToRow(Type, JSONDataMap, bool)/>
Declaration
public static T ToRow<T>(JSONDataMap jsonMap, bool fromUI = true, JSONReader.NameBinding? nameBinding = default(JSONReader.NameBinding? ))
where T : TypedDoc
Parameters
Returns
Type Parameters
Name |
Description |
T |
TypedRow
|
ToRowset(JSONDataMap, Boolean, Boolean)
Deserializes into Rowset or Table from JSONDataMap, as serialized by RowsedBase.WriteAsJSON()
Declaration
public static RowsetBase ToRowset(JSONDataMap jsonMap, bool schemaOnly = false, bool readOnlySchema = false)
Parameters
Type |
Name |
Description |
JSONDataMap |
jsonMap |
|
System.Boolean |
schemaOnly |
|
System.Boolean |
readOnlySchema |
|
Returns
ToRowset(String, Boolean, Boolean)
Deserializes into Rowset or Table from JSOnDataMap, as serialized by RowsedBase.WriteAsJSON()
Declaration
public static RowsetBase ToRowset(string json, bool schemaOnly = false, bool readOnlySchema = false)
Parameters
Type |
Name |
Description |
System.String |
json |
|
System.Boolean |
schemaOnly |
|
System.Boolean |
readOnlySchema |
|
Returns