Skip to main content

JsonExtensions

Assembly: ServiceStack.Text.dll
View Source
Declaration
public static class JsonExtensions

Methods

JsonTo<T>(Dictionary<String, String>, String)

View Source
Declaration
public static T JsonTo<T>(this Dictionary<string, string> map, string key)
Returns

<T>

Parameters
TypeName
System.Collections.Generic.Dictionary<System.String,System.String>map
System.Stringkey
Type Parameters
  • T

Get<T>(Dictionary<String, String>, String, T)

Get JSON string value converted to T

View Source
Declaration
public static T Get<T>(this Dictionary<string, string> map, string key, T defaultValue = null)
Returns

<T>

Parameters
TypeName
System.Collections.Generic.Dictionary<System.String,System.String>map
System.Stringkey
<T>defaultValue
Type Parameters
  • T

GetArray<T>(Dictionary<String, String>, String)

View Source
Declaration
public static T[] GetArray<T>(this Dictionary<string, string> map, string key)
Returns

<T>[]

Parameters
TypeName
System.Collections.Generic.Dictionary<System.String,System.String>map
System.Stringkey
Type Parameters
  • T

Get(Dictionary<String, String>, String)

Get JSON string value

View Source
Declaration
public static string Get(this Dictionary<string, string> map, string key)
Returns

System.String

Parameters
TypeName
System.Collections.Generic.Dictionary<System.String,System.String>map
System.Stringkey

ArrayObjects(String)

View Source
Declaration
public static JsonArrayObjects ArrayObjects(this string json)
Returns

ServiceStack.Text.JsonArrayObjects

Parameters
TypeName
System.Stringjson

ConvertAll<T>(JsonArrayObjects, Func<JsonObject, T>)

View Source
Declaration
public static List<T> ConvertAll<T>(this JsonArrayObjects jsonArrayObjects, Func<JsonObject, T> converter)
Returns

System.Collections.Generic.List<<T>>

Parameters
TypeName
ServiceStack.Text.JsonArrayObjectsjsonArrayObjects
System.Func<ServiceStack.Text.JsonObject,<T>>converter
Type Parameters
  • T

ConvertTo<T>(JsonObject, Func<JsonObject, T>)

View Source
Declaration
public static T ConvertTo<T>(this JsonObject jsonObject, Func<JsonObject, T> convertFn)
Returns

<T>

Parameters
TypeName
ServiceStack.Text.JsonObjectjsonObject
System.Func<ServiceStack.Text.JsonObject,<T>>convertFn
Type Parameters
  • T

ToDictionary(JsonObject)

View Source
Declaration
public static Dictionary<string, string> ToDictionary(this JsonObject jsonObject)
Returns

System.Collections.Generic.Dictionary<System.String,System.String>

Parameters
TypeName
ServiceStack.Text.JsonObjectjsonObject