Table of Contents

Class JsonConvert

Namespace
nanoFramework.Json
Assembly
nanoFramework.Json.dll

Provides methods for converting between .NET types and JSON types.

public static class JsonConvert
Inheritance
JsonConvert
Inherited Members

Methods

DeserializeObject(Stream, Type)

Deserializes a JSON Stream into an object.

public static object DeserializeObject(Stream stream, Type type)

Parameters

stream Stream

The JSON stream to deserialize.

type Type

The type to deserialize to.

Returns

object

The deserialized object.

DeserializeObject(Stream, Type, JsonSerializerOptions)

Deserializes a JSON Stream into an object.

public static object DeserializeObject(Stream stream, Type type, JsonSerializerOptions options)

Parameters

stream Stream

The JSON stream to deserialize.

type Type

The type to deserialize to.

options JsonSerializerOptions

The JsonSerializerOptions to be used during deserialization.

Returns

object

The deserialized object.

DeserializeObject(StreamReader, Type)

Deserializes a JSON StreamReader into an object.

public static object DeserializeObject(StreamReader streamReader, Type type)

Parameters

streamReader StreamReader

The JSON stream reader to deserialize.

type Type

The type to deserialize to.

Returns

object

The deserialized object.

DeserializeObject(StreamReader, Type, JsonSerializerOptions)

Deserializes a JSON StreamReader into an object.

public static object DeserializeObject(StreamReader streamReader, Type type, JsonSerializerOptions options)

Parameters

streamReader StreamReader

The JSON stream reader to deserialize.

type Type

The type to deserialize to.

options JsonSerializerOptions

The JsonSerializerOptions to be used during deserialization.

Returns

object

The deserialized object.

DeserializeObject(string, Type)

Deserializes a JSON string into an object.

public static object DeserializeObject(string value, Type type)

Parameters

value string

The JSON string to deserialize.

type Type

The type to deserialize to.

Returns

object

The deserialized object.

DeserializeObject(string, Type, JsonSerializerOptions)

Deserializes a JSON string into an object.

public static object DeserializeObject(string value, Type type, JsonSerializerOptions options)

Parameters

value string

The JSON string to deserialize.

type Type

The type to deserialize to.

options JsonSerializerOptions

The JsonSerializerOptions to be used during deserialization.

Returns

object

The deserialized object.

SerializeObject(object)

Convert an object to a JSON string.

public static string SerializeObject(object oSource)

Parameters

oSource object

The value to convert. Supported types are: Boolean, String, Byte, (U)Int16, (U)Int32, Float, Double, Decimal, Array, IDictionary, IEnumerable, Guid, Datetime, DictionaryEntry, Object and null.

Returns

string

The JSON object as a string or null when the value type is not supported.

Remarks

For objects, only public properties with getters are converted.