Class DefaultMarshaller
IMarshaller implementation based on Json.NET.
Implements
Inherited Members
Namespace: Worldline.Acquiring.Sdk.Json
Assembly: Worldline.Acquiring.Sdk.dll
Syntax
public sealed class DefaultMarshaller : IMarshaller
Properties
Instance
Declaration
public static DefaultMarshaller Instance { get; }
Property Value
| Type | Description |
|---|---|
| DefaultMarshaller |
Methods
Marshal(object)
Marshal a request object to a JSON string.
Declaration
public string Marshal(object requestObject)
Parameters
| Type | Name | Description |
|---|---|---|
| object | requestObject | The request object. |
Returns
| Type | Description |
|---|---|
| string |
Unmarshal<T>(Stream)
Unmarshal JSON from a stream to a response object.
Declaration
public T Unmarshal<T>(Stream responseJson)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | responseJson | The stream containing a valid JSON string. |
Returns
| Type | Description |
|---|---|
| T |
Type Parameters
| Name | Description |
|---|---|
| T | The response type. |
Exceptions
| Type | Condition |
|---|---|
| MarshallerSyntaxException | if the JSON is not a valid representation for an object of the given type |
Unmarshal<T>(string)
Unmarshal a JSON string to a response object.
Declaration
public T Unmarshal<T>(string responseJson)
Parameters
| Type | Name | Description |
|---|---|---|
| string | responseJson | The JSON that will be parsed. |
Returns
| Type | Description |
|---|---|
| T |
Type Parameters
| Name | Description |
|---|---|
| T | The response type. |
Exceptions
| Type | Condition |
|---|---|
| MarshallerSyntaxException | if the JSON is not a valid representation for an object of the given type |