Serialize

You can use this function to convert object into JSON format.

Syntax

Dim keyValuePairs As Dictionary(Of String, object) = New Dictionary(Of String, object)

Dim jsonString as String = Serialize(keyValuePairs)

Arguments

Part Description
String The value of the data type.
object The object type.

Description

Serialize function converts the specified object into JSON format.

Example

This is an example to serialize object into JSON string.

A dictionary is created to store the object data.

Dim keyValuePairs As Dictionary(Of String, object) = New Dictionary(Of String, object)

The data is stored into the newly created dictionary.

keyValuePairs.Add("Project Code", "P0001")   
  keyValuePairs.Add("Description", "Project Description")
  keyValuePairs.Add("Customer Name", "Customer Name")
  keyValuePairs.Add("Total Cost", 1234.52)

Using the serialize function, the object data is converted into a JSON string.

Dim jsonString as String = Serialize(keyValuePairs)