cancel
Showing results for 
Search instead for 
Did you mean: 

Composite (JSON) Parameter?

graham-onpoint
New Contributor II

Is it possible to evaluate a pipeline parameter that is itself a JSON document?

I am finding a number of use cases for this, especially when using sub-pipelines and you need the input parameters to be pre-defined. It would clutter up a complex sub-pipeline to have a dozen (or more) parameters when really only a few are needed.

A simple example would be to handle date stamps in file names, I have a Box sub-pipeline that is used to filter files by a part of their filename string. Unfortunately this isn’t standardized by our client and the datestamp can appear in a number of positions.

Instead of DATESTAMP_START and DATESTAMP_END parameters I’d like to just have define a single parameter called DATESTAMP containing this value:

{
  "start": 0,
  "end": 8
}

I have tried passing this string through to the Pipeline but get syntax errors trying to read the properties.

Is it possible for the parameter to be a composite JavaScript object and parsed by the expression engine?

2 REPLIES 2

christwr
Contributor III

You can “stringify” a json structure into a string, then pass that string as a parameter to the pipeline, and then “parse” the string back into a json structure in the child pipeline. You can also just pass a json structure to the child as an input document rather than a pipeline parameter, but your options of accessing that data might be more limited if you’re doing binary type operations in the child pipeline.

https://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/1439335/JSON+Functions+and+Properties

Thanks! I’ll be using this in future.