I defined a field called "value" of type JSON (among some other fields) in the resource store. If I run upserts using simple values โโor non-empty arrays, everything works fine:
POST http:
{
"resource_id": "...",
"records": [
{ "value": [ "1", "2" ] }
],
"method": "insert",
"force": "True"
}
POST http:
{
"resource_id": "...",
"records": [
{ "value": "23" }
],
"method": "insert",
"force": "True"
}
However, if I use an empty array
POST http:
{
"resource_id": "...",
"records": [
{ "value": [ ] }
],
"method": "insert",
"force": "True"
}
I get the following error:
{
...
"success": false,
"error": {
"info": {
"orig": [
"malformed record literal: \"{}\"\nLINE 2: VALUES (NULL, NULL, NULL, NULL, '{}', NULL, to_t...\n ^\nDETAIL: Missing left parenthesis.\n"
]
},
"__type": "Validation Error",
"data": "(DataError) malformed record literal: \"{}\"\nLINE 2: VALUES (NULL, NULL, NULL, NULL, '{}', NULL, to_t...\n ^\nDETAIL: Missing left parenthesis.\n"
}
}
Given what [ ]is a valid element in JSON, I wonder why this error occurs. Is this a known issue / bug in the CKAN datastore API?