Hello,
I am having trouble executing a SQL query to import a JSON file queried from an API.
I used the "Parse JSON" step on the body of the API-Response.
The step to execute the query looks like this:

The formula used as input to OPENJSON is
@{body('Parse_JSON')?['response']}
So I think that returns all "response" object in the json.
The json Schema looks like this:
"body": {
"type": "object",
"properties": {
"response": {
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"date": {
"type": "string"
},
"line_item": {
"type": "string"
},
"ID": {
"type": "integer"
},
"discounts": {
"type": "array",
"items": {
"type": "object",
"properties": {
"discountid": {
"type": "integer"
},
"discount_name": {
"type": "string"
}
},
"required": [
"discountid",
"discount_name",
]
}
},
"secondid": {
"type": "integer"
},
"second_name": {
"type": "string"
}
},
"required": [
"date",
"line_item",
"ID",
]
}
},
"total_1": {
"type": "string"
},
"total_2": {
"type": "string"
},
"total_3": {
"type": "string"
},
"gross_3": {
"type": "string"
},
"gross_2": {
"type": "string"
},
"net_1": {
"type": "string"
},
"net_3": {
"type": "string"
}
}
}
}
}
I found this on using OPENJSON() to import json to SQL Server: https://database.guide/how-to-insert-json-into-a-table-in-sql-server/
There must be a problem regarding quotation marks as I get an error for every single colon that is included in string fields of the json file. The final line of the Power Automate error says
Unclosed quotation mark after the character string '}');'.
Any help is much appreciated!