Skip to main content
Version: 4.1

WisejSerializer

Namespace: Wisej.Core

Assembly: Wisej.Framework (4.1.0.0)

Wisej super performant JSON serializer. This is a high performant and low memory footprint JSON serializer/deserializer. It has been optimized to work with Wisej DynamicObject and to streamline serialization/deserialization. It appears to be the fastest JSON serializer/deserializer using the least memory.

public static class WisejSerializer

Properties​

Static member MaxDepth​

Int32: Gets or sets the default maximum nesting depth when parsing JSON. The default is 32.

Each object or array adds one level; a root object or array has depth one. The value must be positive and is captured once at the start of each parse or field lookup.

Throws:

Methods​

Static member Parse(json)​

Deserializes a JSON string to a System.Wisej.Core.DynamicObject.

ParameterTypeDescription
jsonStringThe JSON source string.

Returns: Object. A DynamicObject representing the JSON data.

Throws:

Static member Parse(stream)​

Deserializes a JSON stream to a System.Wisej.Core.DynamicObject.

ParameterTypeDescription
streamStreamThe JSON source stream.

Returns: Object. A DynamicObject representing the JSON data.

Throws:

Static member ReadField(data, fieldName)​

Reads a named field from the root JSON object without constructing the full object graph.

ParameterTypeDescription
dataStringThe JSON source string.
fieldNameStringThe case-sensitive root field name.

Returns: Object. The parsed field value, or null if the field is absent or its value is null.

Uses the same value conversions and depth limit as Parse. Unselected containers are scanned iteratively. The entire root object is scanned to reject duplicate occurrences of the requested field, including those after its first value. Null or empty data returns null. This method does not impose a message-size limit.

Throws:

  • ArgumentException The field name is null or empty.
  • FormatException The root is not an object, the requested field occurs more than once, the depth limit is exceeded, or the JSON structure is incomplete.

Static member Serialize(value, options)​

Serializes an object to standard JSON.

ParameterTypeDescription
valueObjectValue to serialize to JSON.
options optionalWisejSerializerOptionsSerializer options.

Returns: String. The JSON representation of value .