Show / Hide Table of Contents

Class JsonProvider

Contains functions for interacting with the Canonical Smartcrypt JSON Format.

Inheritance
Object
JsonProvider
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: PKWARE.Smartcrypt.Protocol
Assembly: SmartcryptProtocol.dll
Syntax
public static class JsonProvider
Remarks

Smartcrypt does not use standard JSON. In many cases there are strict rules about entry ordering and entry ellision. It is highly recommended that, if communicating with a server using the Canonical Smartcrypt JSON Format, that you use this class to perform serialization and deserialization.

Methods

Decode<T>(String)

Attempts to decode a JSON-like text as the specified type. Decoding follows the rules of the canonical Smartcrypt JSON Format.

Declaration
[ContractAnnotation("json:notnull => notnull; json:null => canbenull")]
[CanBeNull]
public static T Decode<T>([CanBeNull] string json)
Parameters
Type Name Description
String json

The JSON-like text to decode.

Returns
Type Description
T

An instance of type T populated with the data from json. If json is null, returns the default value for type T.

Type Parameters
Name Description
T

The type to decode the JSON as.

Encode(Object)

Encodes a .NET object into the corresponding canonical Smartcrypt JSON Format.

Declaration
[NotNull]
public static string Encode([CanBeNull] object o)
Parameters
Type Name Description
Object o

The object to encode. If null, returns "null".

Returns
Type Description
String

A JSON-like text of the encoded object. The string is fully compatible with RFC-8259.

Back to top Copyright © 2018 PKWARE, Inc.