By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
DECLARE @json NVARCHAR(MAX);
SET @json = N'{
"data": {
"transactions": {
"edges": [
{
"node": {
"text": "debet",
"invoiceAmount": "1.0000"
}
},
{
"node": {
"text": "kredit",
"invoiceAmount": "-1.0000"
}
}
]
}
}
}';
SELECT *
FROM OPENJSON(JSON_QUERY(@json, '$.data.transactions.edges'))
WITH (
text VARCHAR(100) '$.node.text',
invoiceAmount DECIMAL(10,4) '$.node.invoiceAmount'
)
text | invoiceAmount |
---|---|
debet | 1.0000 |
kredit | -1.0000 |