# Create a JSON

## 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 `{}`.

```kog
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".

```kog
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.

```kog
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.

```kog
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"}}`

```kog
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.

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kognitos.com/legacy/legacy-experience/automation-areas/summary-1/to-open-a-json-at-a-file/to-create-a-json.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
