darke
darke

Reputation: 31

What is the best way to store JSON in Postgres

What is the best way to store JSON data in Postgres? Is it possible to query a stored json string without using like/regex?

Upvotes: 2

Views: 5434

Answers (1)

user330315
user330315

Reputation:

The best option is to use a column defined as jsonb.

And yes, Postgres has a lot of functions that let you query the content of a JSON value.

e.g. to check if a key/value pair is contained in the value json_column @> '{"key": "value"}'

Upvotes: 2

Related Questions