Skip to main content

Deleting Nested Attributes via JSON Format

Deleting nested records (e.g., items) via JSON format

Written by Petr Pech

To delete a nested record — typically a document line item — add the attribute @action with the value delete to it in the JSON. The attribute belongs on the specific item, not on the document.


Writing

{
"winstrom": {
"@version": "1.0",
"faktura-vydana": {
"id": "code:VF1-0161/2026",
"polozkyDokladu": {
"faktura-vydana-polozka": {
"@action": "delete",
"id": "1372"
}
}
}
}
}

ℹ️ In the response statistics, this shows up as a document update (updated), not as deleted — the deleted-records counter only tracks top-level records.


Deleting all unlisted items

If you want to keep only specific items and remove the rest, it's simpler to use the removeAll attribute on the collection:

{
"winstrom": {
"faktura-vydana": [{
"id": "123",
"polozkyDokladu@removeAll": "true",
"polozkyDokladu": [{ "id": "14" }]
}]
}
}

⚠️ The name of the items collection differs depending on the record type, and an incorrect name is silently ignored — the document is saved unchanged and the response reports success. polozkyDokladu works universally; to see which name a given record type recognizes, use /c/{firma}/{evidence}/relations.xml.


Related

Did this answer your question?