Common
A library of common classes.
JsonSerialization Class Reference

Contains methods for serializing objects to and from JSON. More...

Static Public Member Functions

static string GetJsonString< T > (T graph, JsonWriterSettings settings=null)
 Returns the JSON string for the object graph. More...
 
static T LoadEncryptedJson< T > (string path, byte[] key)
 Loads the object from an encrypted JSON file. More...
 
static T LoadJson< T > (byte[] bytes)
 Loads a JSON object from a byte array. More...
 
static T LoadJson< T > (string path)
 Loads a JSON object from the specified path. More...
 
static T LoadJsonString< T > (string json)
 Loads a JSON object from a JSON string. More...
 
static void SaveEncryptedJson< T > (string path, T graph, byte[] key)
 Serializes the object as encrypted JSON to the specified path. More...
 
static void SaveJson< T > (string path, T graph)
 Serializes the object as JSON to the specified file path. More...
 

Detailed Description

Contains methods for serializing objects to and from JSON.

Definition at line 10 of file JsonSerialization.cs.

Member Function Documentation

◆ GetJsonString< T >()

static string GetJsonString< T > ( graph,
JsonWriterSettings  settings = null 
)
static

Returns the JSON string for the object graph.

Parameters
graphThe object graph.
settingsThe writer settings. Pretty print used if none specified.

Definition at line 17 of file JsonSerialization.cs.

◆ LoadEncryptedJson< T >()

static T LoadEncryptedJson< T > ( string  path,
byte[]  key 
)
static

Loads the object from an encrypted JSON file.

Parameters
pathThe file path.
keyThe secret key.

Definition at line 112 of file JsonSerialization.cs.

◆ LoadJson< T >() [1/2]

static T LoadJson< T > ( byte[]  bytes)
static

Loads a JSON object from a byte array.

Parameters
bytesA byte array.

Definition at line 72 of file JsonSerialization.cs.

◆ LoadJson< T >() [2/2]

static T LoadJson< T > ( string  path)
static

Loads a JSON object from the specified path.

Parameters
pathThe file path.

Definition at line 58 of file JsonSerialization.cs.

◆ LoadJsonString< T >()

static T LoadJsonString< T > ( string  json)
static

Loads a JSON object from a JSON string.

Parameters
jsonThe JSON string.

Definition at line 86 of file JsonSerialization.cs.

◆ SaveEncryptedJson< T >()

static void SaveEncryptedJson< T > ( string  path,
graph,
byte[]  key 
)
static

Serializes the object as encrypted JSON to the specified path.

Parameters
pathThe file path.
graphThe object graph.
keyThe secret key.

Definition at line 97 of file JsonSerialization.cs.

◆ SaveJson< T >()

static void SaveJson< T > ( string  path,
graph 
)
static

Serializes the object as JSON to the specified file path.

Parameters
pathThe file path.
graphThe object graph.

Definition at line 44 of file JsonSerialization.cs.


The documentation for this class was generated from the following file: