Greetings. I'm getting the following error:
[
{
"message": "Invalid type. Expected Object but got Array.",
"lineNumber": 0,
"linePosition": 0,
"path": "",
"schemaId": "#",
"errorType": "type",
"childErrors": []
}
]
The Sample Schema is:
{
"type": "object",
"properties": {
"body": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"type_id": {
"type": "integer"
},
"external_id": {},
"parent_id": {
"type": "integer"
},
"parent_external_id": {}
},
"required": [
"id",
"name",
"type_id",
"external_id",
"parent_id",
"parent_external_id"
]
}
}
}
}
And the actual JSON I'm trying to parse, returned from a 3rd Party API, is:
{
"body": [
{
"id": 123456,
"name": "ItemName",
"type_id": 654321,
"external_id": null,
"parent_id": 0,
"parent_external_id": null
}
]
}
There's got to be a way to fix this, but I can't seem to figure it out. Thanks in advance for any advice.
Hi, I solved it. I actually needed to remove rather than add.
Thanks.
{
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"type_id": {
"type": "integer"
},
"external_id": {},
"parent_id": {
"type": "integer"
},
"parent_external_id": {}
},
"required": [
"id",
"name",
"type_id",
"external_id",
"parent_id",
"parent_external_id"
]
}
}
Hi Mohamed.
I did as you stated. However, the outputs are unexpected. I get: Body, body, Items, Items. When I try to select id or name, an Apply To Each is automatically created. I've tried various combinations of the output from the previous steps. I chose Body>Body once, but it just entered a never-ending loop creating numerous duplicates of records until it timed out.
Dear Partner,
Add below syntax before "type": "object", and add two }} at the end and validate
Did I answer your question? Please consider to mark my post as a solution to help others.
Regards,
Mohamed Sanuj Basheer