5

I have a postgres table that I am loading data out of for a java application. One of my columns is of type JSON. The problem is JDBC ResultSet does not have a loader for Json. Is my best bet to use resultSet.getString("COLUMN_NAME") or is there another option?

1 Answer 1

8

To read from SQL using ResultSet? No other option (unless it's huge and defined as a CLOB).

To get JSON? Yes. You parse the JSON string you retrieved with getString(), using JSON parser of your choice, e.g. see this article: Top 7 Open-Source JSON-Binding Providers Available Today

Summary:

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks. Couldn't find another place where it was supported... Seemed like the kind of thing that would be implemented given it is a supported datatype in postgres
But it's not a supported datatype in Java or JDBC.
Came back across this now many moons later and realized the difference. Thanks.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.