Class SimpleJson
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 JsonArray(IList<object>) and JsonObject(IDictionary<string,object>).
All numbers are parsed to doubles.
Inheritance
System.Object
SimpleJson
Assembly: FunctionMonkey.Compiler.MSBuild.dll
Syntax
public static class SimpleJson : object
Properties
|
Improve this Doc
View Source
CurrentJsonSerializerStrategy
Declaration
public static IJsonSerializerStrategy CurrentJsonSerializerStrategy { get; set; }
Property Value
|
Improve this Doc
View Source
PocoJsonSerializerStrategy
Declaration
public static PocoJsonSerializerStrategy PocoJsonSerializerStrategy { get; }
Property Value
Methods
|
Improve this Doc
View Source
DeserializeObject(String)
Parses the string json into a value
Declaration
public static object DeserializeObject(string json)
Parameters
Type |
Name |
Description |
System.String |
json |
A JSON string.
|
Returns
Type |
Description |
System.Object |
An IList<object>, a IDictionary<string,object>, a double, a string, null, true, or false
|
|
Improve this Doc
View Source
DeserializeObject(String, Type)
Declaration
public static object DeserializeObject(string json, Type type)
Parameters
Type |
Name |
Description |
System.String |
json |
|
Type |
type |
|
Returns
Type |
Description |
System.Object |
|
|
Improve this Doc
View Source
DeserializeObject(String, Type, IJsonSerializerStrategy)
Declaration
public static object DeserializeObject(string json, Type type, IJsonSerializerStrategy jsonSerializerStrategy)
Parameters
Returns
Type |
Description |
System.Object |
|
|
Improve this Doc
View Source
DeserializeObject<T>(String)
Declaration
public static T DeserializeObject<T>(string json)
Parameters
Type |
Name |
Description |
System.String |
json |
|
Returns
Type Parameters
|
Improve this Doc
View Source
DeserializeObject<T>(String, IJsonSerializerStrategy)
Declaration
public static T DeserializeObject<T>(string json, IJsonSerializerStrategy jsonSerializerStrategy)
Parameters
Returns
Type Parameters
|
Improve this Doc
View Source
EscapeToJavascriptString(String)
Declaration
public static string EscapeToJavascriptString(string jsonString)
Parameters
Type |
Name |
Description |
System.String |
jsonString |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
SerializeObject(Object)
Declaration
public static string SerializeObject(object json)
Parameters
Type |
Name |
Description |
System.Object |
json |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
SerializeObject(Object, IJsonSerializerStrategy)
Converts a IDictionary<string,object> / IList<object> object into a JSON string
Declaration
public static string SerializeObject(object json, IJsonSerializerStrategy jsonSerializerStrategy)
Parameters
Type |
Name |
Description |
System.Object |
json |
A IDictionary<string,object> / IList<object>
|
IJsonSerializerStrategy |
jsonSerializerStrategy |
Serializer strategy to use
|
Returns
Type |
Description |
System.String |
A JSON encoded string, or null if object 'json' is not serializable
|
|
Improve this Doc
View Source
TryDeserializeObject(String, out Object)
Try parsing the json string into a value.
Declaration
public static bool TryDeserializeObject(string json, out object obj)
Parameters
Type |
Name |
Description |
System.String |
json |
A JSON string.
|
System.Object |
obj |
The object.
|
Returns
Type |
Description |
System.Boolean |
Returns true if successfull otherwise false.
|