Articles in this section
Category / Section

How to Create a Dataset with JSONB Values

Published:
Updated:

The JSONB data type is utilized in databases to efficiently store JSON data in a binary format. It is commonly employed in databases like PostgreSQL that support this data type. JSONB is a flexible option for efficiently storing and querying semi-structured or hierarchical data, often represented in JSON format, within a relational database system. The subsequent steps outline the procedure for creating a dataset with JSONB value:

  1. Begin by creating a table in PostgreSQL.
   CREATE TABLE JsonBTable (id serial PRIMARY KEY,jsonbNameAge jsonb;)
  1. Insert JSONB data into the table.
    INSERT INTO JsonBTable (jsonbNameAge) VALUES ('{"name": "John", "age": 32}');
    INSERT INTO JsonBTable VALUES (2,'{"name": "Josh", "age": 29}');
  1. Connect the PostgreSQL and create the dataset.

  2. By following these steps, you will be able to create a report with JSONB columns, as demonstrated in the provided example.

    image.png

  3. To select a specific field from the JSONB table, switch to code mode in the query designer. image.png
    Use the following syntax to select a specific field from the JSONB table

SELECT <<-jsonb_column::jsonb->>‘field_name’ AS extracted_field

  1. Add a table and incorporate the dataset into the table. Preview the report to view the results.
    image.png
    image.png
Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied