# Get a JSON as a String

## Overview

This procedure converts a JSON object to its text (string) representation. The resulting string is a properly formatted JSON string that can be used for storage, transmission, or display purposes. Non-ASCII characters are preserved in the output (not escaped).

## Input

| Concept | Type | Description                     | Required | Default |
| ------- | ---- | ------------------------------- | -------- | ------- |
| json    | json | The JSON object to be converted | Yes      | N/A     |

## Output

| Concept | Description                                  |
| ------- | -------------------------------------------- |
| string  | The string representation of the JSON object |

## Examples

### 1. Converting a simple JSON object to string

This example converts a JSON object to its string representation.

```kog
get the json
get the json as a string
```

### 2. Converting a JSON with special characters

This example demonstrates converting a JSON object with special characters (quotes and percentages) to a string. The result would be: `{"TermsCode": "38", "Description": "0.5% 10 NET 45"}`

```kog
the term is "{\"TermsCode\": \"38\", \"Description\": \"0.5% 10 NET 45\"}"
get the term as a json
get the term as a string
```

### 3. Converting an empty JSON to string

This example shows converting an empty JSON object to its string representation "{}".

```kog
create an empty json
use the above as the best json
the best json
get the best json as a string
```

### 4. Converting a complex JSON structure

This example demonstrates working with a nested JSON structure with multiple levels that can be converted to a string.

```kog
the AddressInformation is '{"BillingAddress": {"Name": "Brown Integrated Logistics"}}'
get the AddressInformation as a 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-get-a-json-as-a-string.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.
