Table of Contents

Class JsonExtensions

Namespace
Nautilus.Json.ExtensionMethods
Assembly
Nautilus.dll
Extension methods for parsing objects as JSON data.
public static class JsonExtensions
Inheritance
JsonExtensions
Inherited Members

Methods

LoadJson<T>(T, string, bool, params JsonConverter[])

Loads the JSON properties from a file on disk into the jsonObject.
public static void LoadJson<T>(this T jsonObject, string path = null, bool createIfNotExist = true, params JsonConverter[] jsonConverters) where T : class

Parameters

jsonObject T
The object instance to load the properties into.
path string
The file path to the JSON file to parse.
createIfNotExist bool
Whether a new JSON file should be created with default values if it does not already exist.
jsonConverters JsonConverter[]
The Newtonsoft.Json.JsonConverters to be used for deserialization.

Type Parameters

T
The type of the jsonObject.
See Also

SaveJson<T>(T, string, params JsonConverter[])

Saves the fields and properties of the jsonObject as JSON properties to the file on disk.
public static void SaveJson<T>(this T jsonObject, string path = null, params JsonConverter[] jsonConverters) where T : class

Parameters

jsonObject T
The object instance to save the fields and properties from.
path string
The file path at which to save the JSON file.
jsonConverters JsonConverter[]
The Newtonsoft.Json.JsonConverters to be used for serialization.

Type Parameters

T
The type of the jsonObject.