Skip to main content

JsonConverter Class

NuGet: GHIElectronics.TinyCLR.Data.Json
Assembly: GHIElectronics.TinyCLR.Data.Json
Namespace: GHIElectronics.TinyCLR.Data.Json

Parses JSON text into a JToken tree and serializes objects back to JSON. Strict-on-emit, generous-on-accept per RFC 8259.

public static class JsonConverter

Methods

object()

public static object SyncObj = new object()

Lock object guarding access to the shared serialization context.

Returns object SyncObj = new

Serialize(object oSource, JsonSerializerSettings settings)

public static JToken Serialize(object oSource, JsonSerializerSettings settings = null)

Serializes an object into a JSON token tree.

Returns JToken

DeserializeObject(string sourceString, Type type, InstanceFactory factory)

public static object DeserializeObject(string sourceString, Type type, InstanceFactory factory = null)

Parses JSON text and populates a new instance of the given type.

Returns object

DeserializeObject(Stream stream, Type type, InstanceFactory factory)

public static object DeserializeObject(Stream stream, Type type, InstanceFactory factory = null)

Parses JSON from a stream and populates a new instance of the given type.

Returns object

DeserializeObject(StreamReader sr, Type type, InstanceFactory factory)

public static object DeserializeObject(StreamReader sr, Type type, InstanceFactory factory = null)

Parses JSON from a reader and populates a new instance of the given type.

Returns object

Deserialize(string sourceString)

public static JToken Deserialize(string sourceString)

Parses JSON text into a token tree.

Returns JToken

Deserialize(Stream sourceStream)

public static JToken Deserialize(Stream sourceStream)

Parses JSON from a stream into a token tree.

Returns JToken

Deserialize(StreamReader sourceReader)

public static JToken Deserialize(StreamReader sourceReader)

Parses JSON from a reader into a token tree.

Returns JToken

FromBson(byte[] buffer, InstanceFactory factory)

public static JToken FromBson(byte[] buffer, InstanceFactory factory = null)

Decodes a BSON byte buffer into a JSON token tree.

Returns JToken

FromBson(byte[] buffer, Type resultType, InstanceFactory factory)

public static object FromBson(byte[] buffer, Type resultType, InstanceFactory factory = null)

Decodes a BSON byte buffer and populates a new instance of the given type.

Returns object

Fields

SerializationContext

public static SerializationCtx SerializationContext

The serialization context shared across the current serialization pass.