Version 22.0.8209


Version 22.0.8209

Loop from a JSON document.

Required Parameters

  • jsonpath: The jsonpath of the specified segment.

Optional Parameters

  • uri: A JSON file URI.
  • handle: The handle of the specified JSON reader.

Output Attributes

  • jsonpath: The jsonpath(s) that match the specified input.
  • name: The Name of the matched element.
  • type: The data type of the matched element.


Consider the JSON data below, which is passed as input data to a Script Connector in CData Arc:

    "Car": "Subaru",
    "Features": [
            "name": "Transmission",
            "value": "Manual"
            "name": "Color",
            "value": "Blue"
            "name": "Interior",
            "value": "Leather"
            "name": "Drivetrain",
            "value": "AWD"

In this Script Connector, you can invoke jsonDOMSearch in ArcScript to search the JSON data for the term Interior and assign the corresponding value (Leather) as a header to a message in Arc. The ArcScript code below shows an example of how to do this:

<arc:set attr="json.uri" value="[Filepath]" />
<arc:set attr="json.jsonPath" value="/json/Features/" />
<arc:call op="jsonDomSearch" in="json" out="result">
  <!-- jsonpath is a context senstive function in arcscript. If a json document is loaded in a 
       search, jsonpath will return the name of a child relative to the search result -->
  <arc:if exp="[jsonpath('name') | equals('Interior')]">
    <arc:set attr="output.header:interiormaterial" value="[jsonpath(‘value’)]" />

<arc:set attr="output.filename" value="[Filename]" />
<arc:push item="output" />

After this code executes, Arc pushes the file with the newly added headers as output down the flow.