SerializeToJSONString

SerializeToJSONString

What to use it for

Prerequisites for usage

Essential properties to set

Use SerializeToJSONString to turn a data object into a JSON string.

 More about (de)serialization

What is serialization

Serialization is the process of translating an object in memory into a stream of data.

Serialization is mostly used for transmitting data, or for storing data to a disk.

A common example where serialization takes place is when you want to use web services to transmit entries in a database over the Internet to another system. You could then turn a database representation of an object into serialized data, such as XML or JSON.

Turning serialized input into an object is called deserialization.

What is JSON

JSON is a human-readable data format built for web data communication between servers and/or browsers. This alternative to XML is largely based on JavaScript, but works well with all major programming languages. JSON stands for JavaScript Object Notation.

Data serialized to XML

<User><FirstName>John</FirstName><SurName>Doe</SurName></User>

Data serialized to JSON

{firstName: "Jane", surName: "Doe" }

SmartBridge can process incoming and create outgoing XML and JSON, both as file and as string.

None.
  • Object to serialize
  • Result

Options

OptionWhat is itHow to use it

Object to serialize (variable or content)

Option to indicate the input data that should be serialized.

  • Either provide the name of the variable that contains the object to be serialized.
    • In this case you require an Activity earlier in the sequence that saved data to a variable.
  • Or directly enter the content to be serialized.

Example of direct entry:

New With { .FirstName = "Jane", .SurName =
"Doe" }
Result

 

Option to save the results to a variable, for use later in the Workflow.

Create a variable to save the results to.

 Read more
Why do I need variables

You can use variables to create a more flexible and sustainable Workflow.

Variables are mostly used in advanced Activities such as the Diversity Activities. These Activities often have two parts:

  • One part is to identify where to get data that serves as input for the Activity.
  • One part is to identify where to store data that serves as output for the Activity.

For the Diversity Activities it is common to store the data resulting from the Activity into a variable. Once stored in the variable, you can re-use the stored value elsewhere in the Workflow, by referring to the variable.

To create a variable to store data
  1. Click on the Variables button, below the Workflow. a panel will appear, containing an editable table.
  2. In the table click on 'Create variable' to start creating a new variable.
  3. Provide a name for the variable, preferably a name that describes its contents. Use camel case.
  4. Indicate the type of variable (e.g. boolean, integer, string, etc.). You can find specific types using 'Browse for types...'.
  5. Moving to another row saves this data to a new entry.

You can now use the name of this variable into one of the fields of the current Activity, or in Activities that are next.