Class JsonSerializationUtils

JSON Serialization helper class that uses JSON.NET. This class serializes JSON to and from string and files on disk.

System.Object
  Westwind.Utilities.JsonSerializationUtils
public static class JsonSerializationUtils : object

Remarks

JSON.NET is loaded dynamically at runtime to avoid hard linking the Newtonsoft.Json.dll to Westwind.Utilities. Just make sure that your project includes a reference to JSON.NET when using this class.

Class Members

MemberDescription

CreateJsonNet

Dynamically creates an instance of JSON.NET

public static object CreateJsonNet(bool throwExceptions)

Deserialize

public static object Deserialize(string jsonText,     Type type,     bool throwExceptions)

DeserializeFromFile

Deserializes an object from file and returns a reference.

public static object DeserializeFromFile(string fileName,     Type objectType,     bool throwExceptions)

FormatJsonString

Takes a single line JSON string and pretty formats it using indented formatting.

public static string FormatJsonString(string json)

Serialize

Serializes an object to an XML string. Unlike the other SerializeObject overloads this methods returns a string rather than a bool result!

public static string Serialize(object value,     bool throwExceptions,     bool formatJsonOutput)

SerializeToFile

Serializes an object instance to a JSON file.

public static bool SerializeToFile(object value,     string fileName,     bool throwExceptions,     bool formatJsonOutput)

Requirements

Namespace: Westwind.Utilities
Assembly: westwind.utilities.dll

© West Wind Technologies, 1996-2016 • Updated: 12/12/15
Comment or report problem with topic