Class JsonExtensionsWeb
JSON Extensions based on the JavaScript Serializer in System.web.
Inheritance
Namespace: DotNetNuke.Common.Utilities
Assembly: DotNetNuke.dll
Syntax
public static class JsonExtensionsWeb : object
Methods
| Improve this Doc View SourceFromJson(String, Type)
Extension method to string that deserializes a JSON string into a specific type. Note that the type specified must be serializable.
Declaration
public static object FromJson(this string json, Type type)
Parameters
Type | Name | Description |
---|---|---|
System.String | json | A JSON string. |
Type | type | The type to deserialize the JSON into. |
Returns
Type | Description |
---|---|
System.Object | The deserialized value. |
FromJson<TType>(String)
Extension method to string that deserializes a JSON string into a specific type. Note that the type specified must be serializable.
Declaration
public static TType FromJson<TType>(this string json)
Parameters
Type | Name | Description |
---|---|---|
System.String | json | A JSON string. |
Returns
Type | Description |
---|---|
TType | The deserialized value. |
Type Parameters
Name | Description |
---|---|
TType | The type to deserialize the JSON into. |
FromJsonString(String, Type)
Deserializes a JSON string into a specific type. Note that the type specified must be serializable.
Declaration
public static object FromJsonString(string json, Type type)
Parameters
Type | Name | Description |
---|---|---|
System.String | json | A JSON string. |
Type | type | The type to deserialize the JSON into. |
Returns
Type | Description |
---|---|
System.Object | The deserialized value. |
ToJson(Object)
Extension method on object that serializes the value to JSON. Note the type must be marked Serializable or include a DataContract attribute.
Declaration
public static string ToJson(this object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The value to serialize. |
Returns
Type | Description |
---|---|
System.String | The JSON string. |
ToJsonString(Object)
Serializes a type to JSON. Note the type must be marked Serializable or include a DataContract attribute.
Declaration
public static string ToJsonString(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The value to serialize. |
Returns
Type | Description |
---|---|
System.String | The JSON string. |