When I try to use do a search for, and using each items value. I get:
[
{“name”: “product 1, product 2”,
“quantity”: 1, 2,
“unitPrice”: 12,24
}
]
So you to iterate each product object in the json structure.
Thanks for the help!
Get your list of line items, then do :formatted as text then inside “craft” your JSON object. There’s a reference "This [thing]'s field1, etc. which is the relevant object for that specific line item. Then make the delimiter , to separate each object.
If the line item is able to have quotes in it and other JSON-breaking characters, do :formatted as JSON safeafter each dynamic value (this also adds quotes around it so don’t manually more more on each side)
And heres how it looks in a workflow from one of my apps. I have a list of ID’s I need to send to a backend database and it iterates through the list into the array
I am trying what you have explained but I run into the problem that I also put double quotes around the keys in my Json object. For example:
[{“Key”: [dynamic value]:formatted_as json safe}]
Might be helpful to have some screenshots so we can see what you are doing. as @tylerboodman says if you’ve got double quotes use JSON Safe. Is the value you are trying to send a string or a number?
I fixed it. I had the json safe function on the wrong level. It also eacaped the double quotes used on the keys. Using it on each specific dynamic value (as mentioned before) made it work. Thanks
Hi guys! Thank you very much for this thread.
I’m using the same function, but apparently, numbers fields (quantity and unit_price) are returned as text when creating the call with “formatted as text” function and it gives me an error for those specific fields.
I tried the generated JSON in Postman and it works perfectly.
I also run the call without the “formatted as text” function (using only 1 item) and it also worked as expected, so I assume the problem is when using that function, that numbers are read as string.
The items must be inside an array, maybe that’s the problem?
How could I make it work?