Table of Contents

Class CJson<Type>

Namespace
CJson
Assembly
CJson.dll

CJson entrypoint class.
Object must be created for any CJson file or content for deserializing.
Only class object to JSON string conversion can be done without object creation.

public sealed class CJson<Type> : Decode

Type Parameters

Type

Class Type should be passed. For more info, see official docs

Inheritance
CJson<Type>
Inherited Members

Constructors

CJson(Path)

Constructor for CJSON/ JSON file path
CJson/JSON file path to be passed with CJson.Path class constructor.
For loading CJSON/JSON raw content, please call CJSON(string content) contructor

public CJson(Path filePath)

Parameters

filePath Path

CJson.Path class constructor

CJson(string)

Constructor for raw CJSON/ JSON content
CJson content to be passed.
For loading CJSON/ JSON file, please create constructor with CJson.Path class For import statements, please specify absolute path to the file to be imported.

public CJson(string content)

Parameters

content string

CJson content in string format

Methods

Deserialize()

Call this method to deserialize CJSON content to ClassType.
If any error in format of the class hierarchy exists, this function will return a null valued object to the provided ClassType

public Type? Deserialize()

Returns

Type

Deserialized class object of Type. Null if Type and CJSON content mismatches

DeserializeAsString()

public string DeserializeAsString()

Returns

string

Inject(Dictionary<string, dynamic>)

Call this function to inject value which expects a dynamic injection.
You can use this function for bulk injection.

For more info, check this link

public Type? Inject(Dictionary<string, dynamic> injectingValues)

Parameters

injectingValues Dictionary<string, dynamic>

Dictionary whose key is location and value is data to be inject

Returns

Type

Inject(string, dynamic)

Call this function to inject value which expects a dynamic injection.
Please note, inject doesnt work on inject at jpath, or inject at any json key.

For more info, check this link

public Type? Inject(string key, dynamic value)

Parameters

key string

Where you want to inject

value dynamic

Value which you want to inject at key

Returns

Type

Deserialized class object of Type. Null if Type and CJSON content mismatches

Remove(List<string>)

public CJson<Type> Remove(List<string> jPathList)

Parameters

jPathList List<string>

Returns

CJson<Type>

Remove(string)

public CJson<Type> Remove(string jPath)

Parameters

jPath string

Returns

CJson<Type>

ToString(dynamic)

Use this function to convert a class object to a JSON string. No CJSON operation can be performed after this function.

public static string ToString(dynamic value)

Parameters

value dynamic

class object

Returns

string