> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arc.cdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# jsonOpen

> Creates a readable handle for JSON data from a URI or static text for use by subsequent operations.

Create a readable handle for JSON data from a URI or static text. This operation is useful when there is a need to read static JSON data, JSON data from a public URI, or JSON data from the output from another operation.

## Required Parameters

* None

## Optional Parameters

* **uri**: A JSON file URI (for example `http://mydomain.com/resources/somedata.json` or `/tmp/myfile.json`).
* **text**: JSON text. This can be static JSON that is set on an ArcScript attribute, or the output from a previous operation in the script (such as the `[http:content]` output attribute of one of the http operations.) See the example below.

## Output Attributes

* **handle**: A readable handle reference to the JSON data. This handle can be used by subsequent operations (see the example below).
* **warning#**: The warning array of the readable JSON handle.

## Example

Here is an example that uses jsonOpen to create a handle for some static JSON text and then pass that handle to another operation (in this case, the second operation is jsonDOMGet):

```xml theme={null}
<!-- Setting a static JSON text -->
<arc:set attr="json.text" value='{"hello": "world","settings": {"foo": "bar"}}' />
<arc:call op="jsonOpen" in="json" out="output" >
  <!-- Setting the json handle as an attribute on a new item that is passed into a second operation  -->
  <arc:set attr="json2.handle" value="[output.handle]" />
  <arc:set attr="json2.map:value1" value="/json/settings/foo" />
  <arc:call op="jsonDOMGet" in="json2" out="output2" >
    <!-- Here is where you can execute additional script for the operation that is using the handle -->
    <!-- This example logs the value of the foo setting from the json text to the application log, which is "bar" -->
    <arc:set attr="_log.info" value="[output2.value1]" />
  </arc:call>
  <arc:finally>
    <!-- Close the json handle -->
    <arc:call op="jsonClose" in="json2" />
  </arc:finally>
</arc:call>
```

<Note>When you use jsonOpen, make sure to use the corresponding [jsonClose](./op-json-close) operation to close the handle at the end of the script to avoid leaking memory through open handles.</Note>

## Additional Resources

The following article is a real-world use case that uses the jsonOpen operation:

* <a href="https://community.cdata.com/cdata-arc-48/dynamic-bearer-token-authorization-in-the-rest-connector-220?tid=220&fid=48" target="_blank">Dynamic Bearer Token Authorization in the REST Connector</a>
