Search Results for

    Show / Hide Table of Contents

    Class JsonArrayUtility

    Helper script for serializing and de-serializing Json Arrays Unity's built in Json Serializer is not able to handle JSON data which have an unnamed array at root level

    Inheritance
    Object
    JsonArrayUtility
    Namespace: i5.Toolkit.Core.Utilities
    Assembly: cs.temp.dll.dll
    Syntax
    public static class JsonArrayUtility

    Methods

    EncapsulateInWrapper(String)

    Helper function to encapsulate a json string which has an unnamed json array at root level in such a way that it can be converted using FromJson()

    Declaration
    public static string EncapsulateInWrapper(string json)
    Parameters
    Type Name Description
    String json

    The original json string

    Returns
    Type Description
    String

    The encapsulated json string which is now ready for json array de-serialization

    FromJson<T>(String)

    Converts a string to an array of the provided type

    Declaration
    public static T[] FromJson<T>(string json)
    Parameters
    Type Name Description
    String json

    The json string

    Returns
    Type Description
    T[]

    Converted array of type T

    Type Parameters
    Name Description
    T

    The array type to convert to

    ToJson<T>(T[], Boolean)

    Converts an array of type T to a json string

    Declaration
    public static string ToJson<T>(T[] array, bool prettyPrint = false)
    Parameters
    Type Name Description
    T[] array

    Array to conver to json data

    Boolean prettyPrint

    If true, the output will be printed in a way that is more human-readable

    Returns
    Type Description
    String

    Json string

    Type Parameters
    Name Description
    T

    The type of the array

    In This Article
    Back to top i5 Toolkit Documentation