Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

How to check value on a Postgres JsonB field?

Open
#101 3 comments 0 reactions 1 assignee View on GitHub

@VanRoy is already working on this.

Since Oct 1, 2020.

Assessment

This issue has not been assessed yet.

Description

enhancement question

I trying to check the values inserted on a table where a field is of the type jsonb.

When I run something like this:

assertThat(eventsTable)
      .row(0)
      .value("data").isEqualTo("{\"key\": \"value\"}");

I get the following error:

[Value at index 0 (column name : DATA) of Row at index 0 of events table] 
Expecting:
  <{"key": "value"}>
to be of type
  <[TEXT, NUMBER, DATE, TIME, DATE_TIME, UUID]>
but was of type
  <NOT_IDENTIFIED> (org.postgresql.util.PGobject)

Here is the table content:

[events table]
|-----------|---------|-------------------------------------------------------|
|           |         |                                                       |
|           | PRIMARY | DATA                                                  |
|           | KEY     | (NOT_IDENTIFIED : class org.postgresql.util.PGobject) |
|           |         | Index : 0                                             |
|-----------|---------|-------------------------------------------------------|
| Index : 0 |         | {"key": "value"}                                      |
|-----------|---------|-------------------------------------------------------|

Using assertj-db 2.0.0

Is there any way I can check the content of a PostgreSQL jsonb column?

Dominant language
Java
Stars
130
Forks
21
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from assertj/assertj-db

All issues in assertj/assertj-db

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.