cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to fetch the complete JSON Array of objects using NodeJS Hana-client from JSON collections

former_member780444
Discoverer
0 Kudos

Hello,

I am stuck in very unfamiliar situation in terms of reading a JSON array (with approx. 400 objects and each object with 3-4 attributes) in my nodeJS application. Using sap/hana-client: 2.6.61 and JSON Collections HANA HDI


  • I am trying to fetch below attribute 'matchingRecords' using basic select SQL query but somehow HANA driver is returning incomplete JSON array which is throwing error while parsing it due to unexpected ending of JSON.
  • I tried to look for any such default length/size limitations for HANA client but no luck so far.
  • Using `exec` function to get the result, also printed the length of result it retrieved which is `20001`, looks like some kind of constraint. But not able to understand any config related to it that can be provided in hana config options during create connection.

Looking for help !

{
..
..
"matchingRecords": [{\"id\": \"20226131546121\", \"xId\": \"20226131334926521\", \"xVId\": \"20226131334924775\"}, {\"id\": \"202261315461213\", \"xId\": \"20226131334926521\", \"xVId\": \"20226131334924775\"}...]
..
..
}

Accepted Solutions (1)

Accepted Solutions (1)

jeff_albion
Employee
Employee
0 Kudos

Can you post your SQL query that's used to select matchingRecords? A likely problem is that you're returning what's described as an NVARCHAR(5000) column on the server in your query, so we only reserve 5000 * 4 (UTF-8 expansion) + 1 (NULL byte) bytes for the column on the driver (giving a total length of 20001).

To fix this, you can likely CAST("matchingRecords" AS CLOB) which will indicate to the server metadata to return a longer data type for the client to bind to.

former_member780444
Discoverer
0 Kudos

It worked. Many thanks. But I am still wondering I don't see any such explanation in the official HANA documentation regarding the data type of column within JSON document.

Answers (0)