Copy link to clipboard
Copied
Hi,
Im trying to generate a document in word using the Adobe Document Generation plugin, using the json data as below. When I click on generated document I get the error as in screenshot below. I Validated the json and didn't find any issues.
Any ideas
[
{
"OwnerID": "L001",
"Properties": [
{
"PropertyID": "P001",
"Property Address": "12 St LA",
"Rent": "300",
"Bedroom": "2"
},
{
"PropertyID": "P002",
"Property Address": "3 St SA",
"Rent": "450",
"Bedroom": "3"
}
]
},
{
"OwnerID": "L002",
"Properties": [
{
"PropertyID": "P003",
"Property Address": "4 St SA",
"Rent": "500",
"Bedroom": "4"
}
]
},
{
"OwnerID": "L003",
"Properties": [
{
"PropertyID": "P004",
"Property Address": "20 St LA",
"Rent": "400",
"Bedroom": "2"
}
]
}
]
Copy link to clipboard
Copied
Are you still getting this error now? Can you share the Word doc?
Copy link to clipboard
Copied
Hi,
its a standard word file and please find below the steps on the document generation using the json. As shared, if I use the first object in the json, there is no error but when the complete json is used, the server error appear. Wondering if there is any issue in the json schema
Thanks
Copy link to clipboard
Copied
So, the error you are getting is weird (btw, this is the same person who responded earlier, I accdentially responded on my personal account), however, the JSON you are sending will not work. You are sending an array of values. In your table, when you say Properties.PropertyID, it expects an array named Properties. You do not have that. You have an array as the top level object with a Properties key under it.
For this to work, you would need a top level value named Properties, that is an array of objects having keys, PropertyID and Rent.
Now, if the data you shared is your original data, don't forget you can adjust your data before calling the API. In this case, I'd have code that makes a new array based on iterating the existing array.
Copy link to clipboard
Copied
As an aside, I can confirm now that our API does *not* support Arrays as a top level object, only, well, objects (key value pairs), you can obviously have arrays underneath that. Our Word Add-In is just checking for valid JSON.
So we need to edit the docs, _and_ the Word Add-In.
To be clear, you can't just take your *existing* array and put it in an object, you need to make Properties itself an array.
Copy link to clipboard
Copied
Hi Raymond
Below is the data source in excel and I'm using power automate to generate the json. I would greatly appreciate if you could provide a the json schema for the table below. Please note the properties are associated with an Owner i.e OwnerID. An Owner can have more than 1 property
Excel Data:
OwnerID | PropertyID | Property Address | Rent | Bedroom |
L001 | P001 | 12 St LA | 300 | 2 |
L001 | P002 | 3 St SA | 450 | 3 |
L002 | P003 | 4 St SA | 500 | 4 |
L003 | P004 | 20 St LA | 400 | 2 |
Thanks
Jag
Copy link to clipboard
Copied
I'm not quite sure what you mean here. When you get the data from Excel, it is an array? If so, then you need to change the data before sending it.
Copy link to clipboard
Copied
Hi Raymond,
I came across the bleow medium article on the same and the json schema looks similar to the above
https://blog.developer.adobe.com/hands-on-with-adobe-document-generation-api-d2176f59026c
Thanks
Jag
Copy link to clipboard
Copied
I wote that article, and I'm pretty sure there are no top level arrays. 🙂 Can you tell me if you see me passing data where the _top_ level value itself is an array?
Copy link to clipboard
Copied
The data source is an excel file as above. As shared, I'm using power automate to convert the excel file to json to bulk generate documents using Adobe Document Generator API.
Here is the link to power automate forum on how the excel table is converted to json:
Could you please share what changes need to be made in the json. Probably a sample template will help please.
Thank you.
Copy link to clipboard
Copied
Unfortunately I don't have a PA example handy that shows how to do this, and the best I can suggest is what I would do - googling for how to reshape data in PA. I firmly believe it's possible. I'd like to help and I'm curious myself how to do this, but I can't promise to have a solution anytime soon.