Serialization and Deserialization of Service Objects

Serialization converts an object into a form that can be persisted or transported. Most commonly, this means converting an object to a string format. The opposite of serialization is Deserialization, which converts a stream into an object, usually so that an underlying system can work with the object. Together, these processes allow data to be easily stored and transferred.

The Generic or "EndPoint" Service Brokers make extensive use of .NET Serialization and Deserialization to deal with complex types. Understanding Serialization and Deserialization requires some knowledge of how .NET stores and transfers data. For more information on Serialization in .NET, see the MSDN Topic on Serialization. In practice, you may find yourself combining serialization and deserialization methods in advanced SmartObject methods to pass values between methods.

For an example that demonstrates how to use Serialization and Deserialization in SmartObjects, see the video How-To: Create a REST Service Instance and SmartObject.
Also see the topic Working with Endpoint SmartObjects: Serialization and Deserialization in the User Guide for more information on serialization and deserialization in SmartObjects.

When working with serialization the property names for the serialization service objects are.

  • Simple Type: serialization and deserialization of basic object types.

  • Complex Type: serialization and deserialization of complex data type objects .

  • Enum: serialization and deserialization of Enums data types.

The basic available Methods.

  • Serialize: Serializes an object into text.
    Input properties - All properties that make up the object.
    Return properties - Serialized object as text.

  • Deserialize: Deserializes text to an object.
    Input properties - Serialized object as text.
    Return properties - All properties that make up the object, returned as simple types and nested serialized objects.

  • Deserialize Array: Deserializes an array to serialized items. If the items are complex, they are returned as serialized values. In some cases this could save a serialize method call.
    Input properties: - Serialized array as text.
    Return properties - All items in the array as serialized text.

  • Deserialize Typed Array: Deserializes an array to deserialized items. If the items are complex, they are deserialized to the properties that make them up. In some cases this could save a deserialize method call.
    Input properties - Serialized array as text.
    Return properties - All items in the array deserialized to the properties that makes them up.

  • Serialize Item To Array: Creates a one item array with the item in it and returns the array as serialized text.
    Input properties: - All properties that makes up the object.
    Return properties - Serialized array as text

  • Serialize List To Array: Takes a generic list and converts it to an array.
    Input properties - Serialized list as text.
    Return properties - Serialized array as text.

  • Serialize Add Item To Array: Adds an item to an existing array.
    Input properties - Serialized array as text. All properties that makes up the object.
    Return properties - Serialized array as text

For entities with complex types or nested objects the complex type or nested object will be returned as serialized items, the serialized item will need to be deserialized before being displayed and in a case where data is being captured the item should be serialized then passed to the SmartObject as a serialized item.

It is also possible to chain SmartObject method to execute more then one method, this is useful for deserializing nested or complex types items in one method execution.