Class JsonConverter
- Namespace
 - Dynamicweb.Core.Json
 
- Assembly
 - Dynamicweb.Core.dll
 
This class provides methods that can serialize and deserialize objects to and from Json.
  
  public class JsonConverter
  - Inheritance
 - 
      
      JsonConverter
 
- Inherited Members
 
Properties
Current
Gets currently used jsonhelper
  
  public static JsonConverter Current { get; }
  Property Value
CurrentCompacted
Gets currently used jsonhelper specialized towards compacted data storage
  
  public static JsonConverter CurrentCompacted { get; }
  Property Value
Settings
Settings used when the Convert methods are being employed.
  
  public JsonSerializerSettings Settings { get; set; }
  Property Value
- JsonSerializerSettings
 
Methods
Convert<T>(T)
Converts the object to a json string.
  
  public static string Convert<T>(T obj)
  Parameters
objT- Object to serialize
 
Returns
- string
 - jsonString
 
Type Parameters
T- Type of object
 
Convert<T>(string)
Json data to deserialize into an object.
  
  public static T Convert<T>(string data)
  Parameters
datastring- Json string
 
Returns
- T
 - object
 
Type Parameters
T- Type of object
 
ConvertToArray(JArray)
Legacy support. Dont use in new code.
  
  public static object[] ConvertToArray(JArray jsonArray)
  Parameters
jsonArrayJArray
Returns
- object[]
 
ConvertToDictionary(JObject)
Legacy support. Dont use in new code.
  
  public static IDictionary<string, object> ConvertToDictionary(JObject jsonObject)
  Parameters
jsonObjectJObject
Returns
Deserialize<T>(string)
Json data to deserialize into an object, using current settings.
  
  public T Deserialize<T>(string data)
  Parameters
datastring- Json string
 
Returns
- T
 - object
 
Type Parameters
T- Type of object
 
Deserialize<T>(string, JsonSettings)
Json data to deserialize into an object.
  
  public static T Deserialize<T>(string data, JsonSettings settings)
  Parameters
datastring- Json string
 settingsJsonSettings- Settings for deserialization
 
Returns
- T
 - object
 
Type Parameters
T- Type of object
 
DeserializeObject(string)
Legacy use only.
  
  public static object DeserializeObject(string json)
  Parameters
jsonstring- Json string
 
Returns
- object
 - JObject or similar
 
DeserializeXmlNode(string)
Deserializes the XmlNode from a JSON string.
  
  public static XmlDocument DeserializeXmlNode(string value)
  Parameters
valuestring- The JSON string
 
Returns
- XmlDocument
 - The deserialized XmlNode
 
DeserializeXmlNode(string, string)
Deserializes the XmlNode from a JSON string nested in a root elment specified by deserializeRootElementName.
  
  public static XmlDocument DeserializeXmlNode(string value, string deserializeRootElementName)
  Parameters
Returns
- XmlDocument
 - The deserialized XmlNode
 
DeserializeXNode(string)
Deserializes the System.Xml.Linq.XNode from a JSON string.
  
  public static XDocument DeserializeXNode(string value)
  Parameters
valuestring- The JSON string.
 
Returns
- XDocument
 - The deserialized XNode
 
DeserializeXNode(string, string)
Deserializes the System.Xml.Linq.XNode from a JSON string nested in a root elment specified by deserializeRootElementName.
  
  public static XDocument DeserializeXNode(string value, string deserializeRootElementName)
  Parameters
valuestring- The JSON string.
 deserializeRootElementNamestring- The name of the root element to append when deserializing
 
Returns
- XDocument
 - The deserialized XNode
 
GetSettingsCompact()
Gets the settings used by dynamicweb for compact json.
  
  public static JsonSettings GetSettingsCompact()
  Returns
- JsonSettings
 - settings
 
GetSettingsHumanReadable()
Gets the settings used by dynamicweb for human readable json.
  
  public static JsonSettings GetSettingsHumanReadable()
  Returns
- JsonSettings
 - settings
 
ParseArgumentsList(string)
public static List<object> ParseArgumentsList(string arguments)
  Parameters
argumentsstring
Returns
ParseArgumentsObject(string)
public static Dictionary<string, object> ParseArgumentsObject(string arguments)
  Parameters
argumentsstring
Returns
Serialize<T>(T)
Converts the object to a json string, using current settings.
  
  public string Serialize<T>(T obj)
  Parameters
objT- Object to serialize
 
Returns
- string
 - jsonString
 
Type Parameters
T- Type of object
 
Serialize<T>(T, JsonSettings)
Converts the object to a json string.
  
  public static string Serialize<T>(T obj, JsonSettings settings)
  Parameters
objT- Object to serialize
 settingsJsonSettings- Settings for serialization
 
Returns
- string
 - jsonString
 
Type Parameters
T- Type of object