I was recently helping one of our users when I discovered something that may not be terribly clear in our docs. When we talk about the Document Generation API, we say that you can use any data you want, as long as it can be converted to JSON (which is handled by the SDK).
There is as small caveat to that. The data you send to use must be an object, and by that I mean a set of key/value pairs. So for example:
In the example above, we have an object with two keys, name and hobbies. Arrays are just fine... just not as the 'top level' object. This means the following would *not* work with our service:
That is certainly a valid 'object' and could be converted to JSON, but it won't work with our service.
So - this serves as an excellent reminder that while you can source your data from anything, sometimes you may need to 'shape' your data ahead of time. If your data is an array, like above, just wrap it in an object:
"stuff": [ "foo","moo","goo" ]
This is also useful when the formatting functions that work in JSONata aren't expressive enough for your needs. You can simply format your data yourself before sending it.