I custom a Content type and with a content task in my workflow to save some data.
There is an array in the content task that was customed by me.
But the workflow can't save it.

Shouldn't the outcome be:
"Paths": [ "John", "Paul", "George", "Ringo" ]
Could script that with for each...
There are other filters to join a list of values, correct. And don't forget to use the json and raw ones too if they are strings.
Shouldn't the outcome be:
"Paths": [ "John", "Paul", "George", "Ringo" ]
Could script that with for each...
It's input,not output.
There are other filters to join a list of values, correct. And don't forget to use the json and raw ones too if they are strings.
join (standard liquid) and json (orchard filter) could be used to produce the required output:
"Paths": [ {{ names | json | join ", " }} ]
But might have to iterate over items with for … in ... and apply json and hardcode ", "
There are other filters to join a list of values, correct. And don't forget to use the json and raw ones too if they are strings.
join(standard liquid) andjson(orchard filter) could be used to produce the required output:
"Paths": [ {{ names | json | join ", " }} ]
Thank for your answer.
I try the code like what you write:'[ {{ names | json | join: " , " }} ]'
But,it seems does not work.
I updated my answer
I updated my answer
I am not sure that do you understand my requirement.
I use the 'Create Content Task' function in a workflow that I custom.
The 'Create Content Task' receives data from form page and converts to a content type .
Last,save the data into database.
Thank you.
You want to generate JSON with Liquid?
If that is the case, then using the json filter could simplify the output generation, ex:
"Text": {{ Request.Form.ContactNumber | json}} or use | raw depending on the content.
Then processing the array, you could use:
"Paths": [ {% for name in names %}
{{ name | json }},
{% endfor %} ]
It would leave a , at the end, which in the last element you don't need, but probably it will not be an issue?
or perhaps, you can try:
"Paths": [ "{{ names | join "\", \"" }}" ]
I think the question is quite well answered now.
Most helpful comment
I think the question is quite well answered now.