K_Anudeep
Databricks Employee
Databricks Employee

Hello @EricCournarie ,

I believe this is a JDBC driver limitation. The Databricks JDBC driver serializes complex types (STRUCT/ARRAY) to a JSON-like string but doesn’t always quote DATE/TIMESTAMP (and some characters) correctly, so rs.getObject()/rs.getString() can yield invalid JSON. 

Similar thread: https://stackoverflow.com/questions/79432459/how-to-fetch-nested-data-structures-in-databricks-using...

One way to fix this is to serialise on the server with to_json

SELECT
  id,
  nom,
  to_json(infos, map('dateFormat','yyyy-MM-dd','timestampFormat','yyyy-MM-dd HH:mm:ss.SSS')) AS infos_json,
  to_json(tags) AS tags_json
FROM main.eric.eric_complex_team;​
Anudeep