user3701757
user3701757

Reputation: 41

How to store Gson object as a Json type in postgres

I have datatype called "json" in postgres db. I wanted to insert data gson object from java code.

How can i insert gson object data into json column of table in postgres database?

Can any one help me?

Thanks,

Upvotes: 1

Views: 1969

Answers (1)

Ashok_Pradhan
Ashok_Pradhan

Reputation: 1169

In Postgres SQL the json type is similar to text type and in java the corresponding mapping will be String type.The important thing is that json String must be valid json because there is a validation at database end.

Refer this link for clarification

Upvotes: 4

Related Questions