Interface: Marshaller

x2node-ws. Marshaller

Interface for marshallers that are used to parse HTTP request and serialize HTTP response payloads given the content type.

Methods


deserialize(data, contentType)

Deserialize the specified buffer into an object.
Parameters:
Name Type Description
data external:Buffer Binary data to deserialize.
contentType string Content type (may have optional charset argument).
Throws:
If the binary data is invalid and cannot be deserialized.
Type
module:x2node-common.X2DataError
Returns:
The deserialized object.
Type
Object

serialize(obj, contentType)

Serialize the specified object for sending it in an HTTP response.
Parameters:
Name Type Description
obj Object Object to serialize.
contentType string Content type (may have optional charset argument).
Returns:
Serialized data.
Type
external:Buffer