Class JsonProvider
Contains functions for interacting with the Canonical Smartcrypt JSON Format.
Inherited Members
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 |
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 |
Returns
Type | Description |
---|---|
String | A JSON-like text of the encoded object. The string is fully compatible with RFC-8259. |