Retrieve JSON column value #253
-
Hello, I was wondering if it was possible to get a properly parsed object for a JSON column when retrieving data with |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You could extend any of the converters, including the JsonDuckDBValueConverter, to do this. You'd just change the function for VARCHAR, because JSON columns use VARCHAR under the covers. That function receives the column type, and you can distinguish JSON columns from other VARCHARs by looking at the alias property of the type. Using a STRUCT or MAP type could also be a good solution, if you can control how the data is structured. Storing data as one of those types likely to be significantly more efficient than using the JSON type. |
Beta Was this translation helpful? Give feedback.
You could extend any of the converters, including the JsonDuckDBValueConverter, to do this. You'd just change the function for VARCHAR, because JSON columns use VARCHAR under the covers. That function receives the column type, and you can distinguish JSON columns from other VARCHARs by looking at the alias property of the type.
Using a STRUCT or MAP type could also be a good solution, if you can control how the data is structured. Storing data as one of those types likely to be significantly more efficient than using the JSON type.