Improve this Doc View Source

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) and JsonObject(IDictionary). All numbers are parsed to doubles.

Inheritance
System.Object
SimpleJson
Namespace:Dapplo.HttpExtensions
Assembly:Dapplo.HttpExtensions.dll
Syntax
public class SimpleJson

Properties

| Improve this Doc View Source

CurrentJsonSerializerStrategy

Declaration
public static IJsonSerializerStrategy CurrentJsonSerializerStrategy { get; set; }
Returns
Type Description
IJsonSerializerStrategy
| Improve this Doc View Source

DataContractJsonSerializerStrategy

Declaration
public static DataContractJsonSerializerStrategy DataContractJsonSerializerStrategy { get; }
Returns
Type Description
DataContractJsonSerializerStrategy
| Improve this Doc View Source

PocoJsonSerializerStrategy

Declaration
public static PocoJsonSerializerStrategy PocoJsonSerializerStrategy { get; }
Returns
Type Description
PocoJsonSerializerStrategy

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, a IDictionary, 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
System.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
Type Name Description
System.String json
System.Type type
IJsonSerializerStrategy jsonSerializerStrategy
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 Description
T
| Improve this Doc View Source

DeserializeObject<T>(String, IJsonSerializerStrategy)

Declaration
public static T DeserializeObject<T>(string json, IJsonSerializerStrategy jsonSerializerStrategy)
Parameters
Type Name Description
System.String json
IJsonSerializerStrategy jsonSerializerStrategy
Returns
Type Description
T
| 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

Minify(String)

Declaration
public static string Minify(string json)
Parameters
Type Name Description
System.String json

JSON string to compress

Returns
Type Description
System.String

minified JSON 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 / IList object into a JSON string

Declaration
public static string SerializeObject(object json, IJsonSerializerStrategy jsonSerializerStrategy)
Parameters
Type Name Description
System.Object json

A IDictionary / IList

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.