> ## 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

> URI または静的テキストからJSON データの読み取り可能なハンドルを作成し、後続のオペレーションで使用できるようにします。

URI または静的テキストからJSON データの読み取り可能なハンドルを作成します。このオペレーションは、静的なJSON データ、パブリックURI からのJSON データ、または別のオペレーションのアウトプットからのJSON データを読み取る必要がある場合に役立ちます。

## 必要なパラメータ

* なし

## オプションのパラメータ

* **uri**：JSON ファイルのURI（例：`http://mydomain.com/resources/somedata.json` または `/tmp/myfile.json`）。
* **text**：JSON テキスト。ArcScript アトリビュートに設定された静的なJSON、またはスクリプト内の前のオペレーションのアウトプット（http オペレーションの`[http:content]` アウトプット属性など）を指定できます。以下の例を参照してください。

## アウトプット属性

* **handle**：JSON データへの読み取り可能なハンドル参照。このハンドルは後続のオペレーションで使用できます（以下の例を参照してください）。
* **warning#**：読み取り可能なJSON ハンドルの警告配列。

## 例

次の例では、jsonOpen を使用して静的なJSON テキストのハンドルを作成し、そのハンドルを別のオペレーション（この場合は2番目のオペレーションである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>jsonOpen を使用する際は、開いたままのハンドルによるメモリリークを避けるため、スクリプトの最後で対応する[jsonClose](./op-json-close) オペレーションを使用してハンドルをクローズしてください。</Note>

## その他のリソース

次の記事は、jsonOpen オペレーションを使用した実際のユースケースです：

* <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>
