AngeliA
Search Results for

    Show / Hide Table of Contents

    Class JsonUtil

    Utility class for json operation

    Methods

    GetJsonPath<T>(string, string, string)

    Calculate auto path fot json file

    Declaration
    public static string GetJsonPath<T>(string rootPath, string name = "", string ext = "json")
    Parameters
    Type Name Description
    string rootPath

    Root folder

    string name

    Name that override the type name

    string ext

    Extension of the file

    Type Parameters
    Name Description
    T

    Type of the json object

    LoadJsonFromPath<T>(string)

    Load json file at given path.

    Declaration
    public static T LoadJsonFromPath<T>(string jsonPath)
    Returns
    Type Description
    T

    Json object instance if file valid. Return default if file not valid

    Type Parameters
    Name Description
    T

    Type of the json object

    LoadJson<T>(string, string, string)

    Load json file inside given folder.

    Declaration
    public static T LoadJson<T>(string rootPath, string name = "", string ext = "json")
    Parameters
    Type Name Description
    string rootPath

    Root folder

    string name

    Name that override the type name

    string ext

    Extension of the file

    Returns
    Type Description
    T

    Json object instance if file valid. Return default if file not valid.

    Type Parameters
    Name Description
    T

    Type of the json object

    LoadOrCreateJsonFromPath<T>(string)

    Load json file at given path. Create new instance if file not found.

    Declaration
    public static T LoadOrCreateJsonFromPath<T>(string jsonPath) where T : new()
    Type Parameters
    Name Description
    T

    Type of the json object

    LoadOrCreateJson<T>(string, string, string)

    Load json file inside given folder. Create new instance if file not found.

    Declaration
    public static T LoadOrCreateJson<T>(string rootPath, string name = "", string ext = "json") where T : new()
    Parameters
    Type Name Description
    string rootPath

    Root folder

    string name

    Name that override the type name

    string ext

    Extension of the file

    Type Parameters
    Name Description
    T

    Type of the json object

    SaveJsonToPath(object, string, bool)

    Save json object into given path

    Declaration
    public static void SaveJsonToPath(object data, string jsonPath, bool prettyPrint = false)
    bool prettyPrint

    True if write with indent and line warp

    SaveJson<T>(T, string, string, string, bool)

    Save json object into given folder

    Declaration
    public static void SaveJson<T>(T data, string rootPath, string name = "", string ext = "json", bool prettyPrint = false)
    string rootPath

    Root folder path

    string name

    Name that override the type name

    string ext

    Extension of the file

    bool prettyPrint

    True if write with indent and line warp

    Type Parameters
    Name Description
    T

    Type of the json object

    Back to top ๐Ÿ„๐Ÿฆโ€โฌ›๐Ÿงฆ๐Ÿˆ๐ŸŽƒ๐Ÿ’“๐ŸŒนโ˜•๐Ÿดโ€โ˜ ๏ธ๐Ÿค