JSONTOXML error
vagelis.pertsinis Mar 27, 2015 9:11 AMHi,
I'm having difficulties with parsing the JSON request from our API and accessing the data. The typical response from our API is
:
{
"batchId": "4485aabb13e54f23a2df7e2685f4b06d",
"results": [
{
"requestId": "ac04922ef14641bfa3a0593301a79389",
"values": [
[
{
"columnId": 17,
"value": "BLG001"
},
{
"columnId": 18,
"value": "Sydney Bennelong Plaza"
},
{
"columnId": 43,
"value": "Retail"
},
{
"columnId": -2,
"value": 40813
},
{
"columnId": -1,
"value": 0
}
],
[
{
"columnId": 17,
"value": "BLG002"
},
{
"columnId": 18,
"value": "Sydney George St Store"
},
{
"columnId": 43,
"value": "Retail"
},
{
"columnId": -2,
"value": 40814
},
{
"columnId": -1,
"value": 1
}
]
],
"error": null
}
]
}
This creates the following error in Teiid:
org.teiid.runtime.client.TeiidClientException: java.lang.RuntimeException: Remote org.teiid.core.TeiidProcessingException: TEIID30171 Unexpected multi-valued result was returned for XMLTable column "columnId". Path expressions for non-XML type columns should return at most a single result.
The xpath used to get the columnId field is:
... COLUMNS columnId string PATH '/results/values//columnId/text()') AS A;
I kind of understand the difficulty in parsing the response after it gets converted to XML, I'm just wondering if there is a workaround.
Cheers
Vagos