Package org.apache.sling.pipes.internal.inputstream

## Class JsonPipe

- java.lang.Object
- - org.apache.sling.pipes.BasePipe
  - - org.apache.sling.pipes.AbstractInputStreamPipe
    - - org.apache.sling.pipes.internal.inputstream.JsonPipe

All Implemented Interfaces:
  `Pipe`

    public class JsonPipe
    extends AbstractInputStreamPipe

Pipe outputting binding related to a json stream: either an object

### Field Summary

Fields
`protected static String` `ARRAY_START`
`protected static String` `INDEX_SUFFIX`
`static String` `JSON_KEY`
`protected static Pattern` `JSONPATH_FIRSTTOKEN`
`protected static String` `JSONPATH_ROOT`
`protected static String` `OBJ_START`
`protected static String` `PN_RAW` property specifying wether we should bind the computed json as a whole, or loop over it (not set or raw=false)
`protected static String` `PN_VALUEPATH` property specifying the json path where to fetched the used value
`static String` `RESOURCE_TYPE`

### Fields inherited from class org.apache.sling.pipes.AbstractInputStreamPipe

`binding, BINDING_IS, REMOTE_START, VALID_PATH`

### Fields inherited from class org.apache.sling.pipes.BasePipe

`afterHook, beforeHook, bindingProviders, bindings, distributionAgent, DRYRUN_EXPR, DRYRUN_KEY, EMPTY_ITERATOR, IGNORED_NODES, IGNORED_PROPERTIES, parent, plumber, PN_AFTERHOOK, PN_BEFOREHOOK, PN_STATUS, PN_STATUS_MODIFIED, properties, READ_ONLY, resolver, resource, RT_PREFIX, SLASH, STATUS_FINISHED, STATUS_STARTED`

### Fields inherited from interface org.apache.sling.pipes.Pipe

`NN_CONF, PN_DISTRIBUTION_AGENT, PN_EXPR, PN_NAME, PN_PATH`

### Constructor Summary

Constructors
`JsonPipe​(Plumber plumber, org.apache.sling.api.resource.Resource resource, PipeBindings upperBindings)`

### Method Summary

All Methods Instance Methods Concrete Methods
`Iterator<org.apache.sling.api.resource.Resource>` `getOutput​(InputStream is)` in case there is no successful retrieval of some JSON data, we cut the pipe here
`protected javax.json.JsonStructure` `getValue​(javax.json.JsonStructure json, String valuePath)` Returns fetched json value from value path

### Methods inherited from class org.apache.sling.pipes.AbstractInputStreamPipe

`after, computeOutput, getOutputBinding`

### Methods inherited from class org.apache.sling.pipes.BasePipe

`before, getBindings, getComputedPath, getConfiguration, getDistributionAgent, getExpr, getInput, getName, getOutput, getParent, getPath, getPreviousPipe, getPreviousResource, getRawExpression, getRawPath, getResource, isDryRun, isRootPath, modifiesContent, provideAdditionalBindings, setParent, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### JSON_KEY

    public static final String JSON_KEY

See Also:
  Constant Field Values

#### RESOURCE_TYPE

    public static final String RESOURCE_TYPE

See Also:
  Constant Field Values

#### PN_VALUEPATH

    protected static final String PN_VALUEPATH

property specifying the json path where to fetched the used value

See Also:
  Constant Field Values

#### PN_RAW

    protected static final String PN_RAW

property specifying wether we should bind the computed json as a whole, or loop over it (not set or raw=false)

See Also:
  Constant Field Values

#### JSONPATH_ROOT

    protected static final String JSONPATH_ROOT

See Also:
  Constant Field Values

#### ARRAY_START

    protected static final String ARRAY_START

See Also:
  Constant Field Values

#### OBJ_START

    protected static final String OBJ_START

See Also:
  Constant Field Values

#### INDEX_SUFFIX

    protected static final String INDEX_SUFFIX

See Also:
  Constant Field Values

#### JSONPATH_FIRSTTOKEN

    protected static final Pattern JSONPATH_FIRSTTOKEN

### Constructor Detail

#### JsonPipe

    public JsonPipe​(Plumber plumber,
                    org.apache.sling.api.resource.Resource resource,
                    PipeBindings upperBindings)

### Method Detail

#### getOutput

    public Iterator<org.apache.sling.api.resource.Resource> getOutput​(InputStream is)

in case there is no successful retrieval of some JSON data, we cut the pipe here

Specified by:
  `getOutput` in class `AbstractInputStreamPipe`
Returns:
  input resource of the pipe, can be reouputed N times in case output json binding is an array of N element (output binding would be here each time the Nth element of the array)

#### getValue

    protected javax.json.JsonStructure getValue​(javax.json.JsonStructure json,
                                                String valuePath)

Returns fetched json value from value path

Parameters:
  `json` - json structure from which to start
  `valuePath` - path to follow
Returns:
  value fetched after following the path