Class Json
This class encodes and decodes JSON strings. Spec. details, see http://www.json.org/
JSON uses Arrays and Objects. These correspond here to the datatypes IList and IDictionary. All numbers are parsed to doubles.
Inheritance
System.Object
Json
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ToString()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: StansAssets.Foundation
Assembly: cs.temp.dll.dll
Syntax
public static class Json
Methods
Deserialize(String)
Parses the string json into a value
Declaration
public static object Deserialize(string json)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | json | A JSON string. |
Returns
| Type | Description |
|---|---|
| System.Object | An List<object>, a Dictionary<string, object>, a double, an integer,a string, null, true, or false |
Serialize(Object, Boolean, Int32)
Converts a IDictionary / IList object or a simple type (string, int, etc.) into a JSON string
Declaration
public static string Serialize(object obj, bool humanReadable = false, int indentSpaces = 2)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | |
| System.Boolean | humanReadable | Whether output as human readable format with spaces and indentations. |
| System.Int32 | indentSpaces | Number of spaces for each level of indentation. |
Returns
| Type | Description |
|---|---|
| System.String | A JSON encoded string, or null if object 'json' is not serializable |