Story #9031
closed[SDKs] arv-run-pipeline-instance accepts json objects/arrays as script parameter values
0%
Description
Currently it is impossible to pass a JSON object as a script parameter. For example,
arv-run-pipeline-instance 'foo::input={"foo":"bar"}'
results in
"script_parameters":{ "input":"{\"foo\":\"bar\"} }
Updated by Brett Smith over 8 years ago
- Tracker changed from Bug to Story
- Subject changed from arv-run-pipeline-instance should accept json objects/arrays as script parameter values to [SDKs] arv-run-pipeline-instance accepts json objects/arrays as script parameter values
Tom, since you pointed this, is there a particular fix you had in mind?
Updated by Brett Smith over 8 years ago
Note that at least one pipeline author has written Crunch scripts that expect exactly these "JSON strings" and reads them in with json.loads()
. Part of the reason for that is Workbench doesn't have any support for input arrays or objects either, so letting pipeline users simply write the JSON by hand in a string is actually the most straightforward solution right now.
Updated by Brett Smith over 8 years ago
Proposed implementation: if your input starts with ", [, or {, it's assumed to be JSON, parsed as such, and then the resulting value is stored as the value of the corresponding parameter.
This potentially breaks compatibility for existing callers of a-r-p-i, but we think we can live with it since it's easy enough to work around: just double-quote (and potentially escape) your string.
Updated by Abram Connelly over 8 years ago
Why not add in a flag so old behavior stays the same while still giving the user the option for more complex parameter passing? Something like:
arv-run-pipeline-instance --json-param 'foo::input={"foo":"bar"}'
Updated by Tom Clegg over 8 years ago
...or even
arv-run-pipeline-instance --param 'foo::input={"foo":"bar"}'
?