Tesseract Tools - Documentation  UnityTools
Professional grade GameDev tools
Loading...
Searching...
No Matches
TesseractTools.Core.JsonUtils Class Reference

A JSON Utils class which provides more robust json support across different Unity versions More...

Static Public Member Functions

static T FromJson< T > (string json)
 Converts a string of json text to the specified type T. Note due to the limitations of Unity's json utility across different editor versions please use FromJsonArray<T>(string) for deserializing pure arrays or lists More...
 
static T[] FromJsonArray< T > (string json)
 Deserializes a pure T[] of objects T. This is not natively supported on all unity editors and so a workaround is implemented inside this method to achieve support which is provided by something more robust like Newtownsoft but which may not always be installed. More...
 
static List< T > FromJsonList< T > (string json)
 Deserializes a pure List<T> of objects T. This is not natively supported on all unity editors and so a workaround is implemented inside this method to achieve support which is provided by something more robust like Newtownsoft but which may not always be installed. More...
 
static string ToJson (object obj)
 Converts an object to a string of JSON More...
 
static string ToJson (object obj, bool isPrettyPrint)
 Converts an object to a string of JSON More...
 

Detailed Description

A JSON Utils class which provides more robust json support across different Unity versions

Member Function Documentation

◆ FromJson< T >()

static T TesseractTools.Core.JsonUtils.FromJson< T > ( string  json)
static

Converts a string of json text to the specified type T. Note due to the limitations of Unity's json utility across different editor versions please use FromJsonArray<T>(string) for deserializing pure arrays or lists

Template Parameters
TThe type to return
Parameters
jsonJSON Formatted text
Returns

◆ FromJsonArray< T >()

static T[] TesseractTools.Core.JsonUtils.FromJsonArray< T > ( string  json)
static

Deserializes a pure T[] of objects T. This is not natively supported on all unity editors and so a workaround is implemented inside this method to achieve support which is provided by something more robust like Newtownsoft but which may not always be installed.

Template Parameters
TThe type to return
Parameters
jsonJSON Formatted text
Returns

◆ FromJsonList< T >()

static List< T > TesseractTools.Core.JsonUtils.FromJsonList< T > ( string  json)
static

Deserializes a pure List<T> of objects T. This is not natively supported on all unity editors and so a workaround is implemented inside this method to achieve support which is provided by something more robust like Newtownsoft but which may not always be installed.

Template Parameters
TThe type to return
Parameters
jsonJSON Formatted text
Returns

◆ ToJson() [1/2]

static string TesseractTools.Core.JsonUtils.ToJson ( object  obj)
static

Converts an object to a string of JSON

Parameters
objThe object to convert to JSON
Returns

◆ ToJson() [2/2]

static string TesseractTools.Core.JsonUtils.ToJson ( object  obj,
bool  isPrettyPrint 
)
static

Converts an object to a string of JSON

Parameters
objThe object to convert to JSON
isPrettyPrintShould this be formatted nicely or not?
Returns

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