Version 24.2.8965


Version 24.2.8965

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.


  • None


  • 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.


  • 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.

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):

<!-- 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]" />
    <!-- Close the json handle -->
    <arc:call op="jsonClose" in="json2" />

Note: When you use jsonOpen, make sure to use the corresponding jsonClose operation to close the handle at the end of the script to avoid leaking memory through open handles.

Additional Resources

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