Create a JSON

Creates an empty JSON object.

Overview

This procedure creates an empty JSON object (represented as {}). This is useful as a starting point for building up a JSON structure by adding fields one at a time. The empty JSON object can then be assigned to a fact and populated with data.

Input

This procedure has no input concepts.

Output

Concept
Description

json

An empty JSON object {}

Examples

1. Creating a simple empty JSON

This example creates an empty JSON object {}.

create a json

2. Creating and using an empty JSON

This example creates an empty JSON object and assigns it to a fact called "request".

create a json
use the above as the request
the request

3. Creating and populating a JSON object

This example creates an empty JSON and then populates it with three fields: name, age, and company.

create a empty json
use the above as json1
set the json1's name to "kalpesh"
set the json1's age to 28
set the json1's company to "Kognitos"

4. Creating multiple JSON objects

This example creates another empty JSON object with a different fact name and populates it with company and address fields.

create an empty json
use the above as json2
set the json2's company to "XYZ"
set the json2's address to "Bangalore"

5. Creating JSON for nested structures

This example creates multiple JSON objects and nests one within another. The result would be: {"data": {"age": "23"}}

the internaljson is "{}"
the internaljson is a json
set the internaljson's age to "23"
the finaljson is "{}"
get the finaljson as a json
the finaljson is a json
set the finaljson's data to the internaljson

6. Creating JSON for use with merge operations

This example creates an empty JSON object that will be used to merge or combine data from other sources.

create an empty json
use the above as the main json
set the main json's "attachment" to the attachment json

Last updated

Was this helpful?