
Expanding JSONB Into Typed Rows With jsonb_to_recordset
Turn a JSONB array of objects into typed SQL columns with jsonb_to_recordset, jsonb_populate_recordset and jsonb_each, with the errors and edge cases.
Everything you need to level up your coding skills.

Turn a JSONB array of objects into typed SQL columns with jsonb_to_recordset, jsonb_populate_recordset and jsonb_each, with the errors and edge cases.

Search, count, filter and rebuild JSON arrays inside PostgreSQL JSONB, from containment tests to jsonb_array_elements, with timings for five tag lookups.

Build GIN indexes on JSONB, choose between jsonb_ops and jsonb_path_ops, and see the real size, build, insert and query costs on a 200,000-row table.

Add, rename, merge and delete keys and array elements in PostgreSQL JSONB with jsonb_set, jsonb_insert, || and minus, and see where each does nothing.

Change a single field in a PostgreSQL JSONB document with jsonb_set or subscripts, increment a counter, and avoid the lost-update and rewrite costs.

PostgreSQL reads deep JSONB values with #> and #>>, and filters with jsonpath. How array paths, missing keys, strict mode and wildcards actually behave.

How -> and ->> read keys and array elements in PostgreSQL JSONB, what comes back for missing keys, and the precedence and casting traps that bite.

One XML file converted to JSON, CSV, YAML and Excel with one parse and four writers, what each target loses, and how to prove nothing went missing.

PostgreSQL has two JSON types. What each keeps, drops and costs, measured on 200,000 rows, and the narrow cases where plain json is the right choice.

A working guide to JSONB in PostgreSQL 18: reading, filtering, updating, unnesting and aggregating documents, then GIN and expression indexes, with timings.

Text copied from console.log, DevTools or a config file is often a JavaScript object, not JSON. What differs, what is lost, and how to convert it safely.

A response or file that stops mid-document fails with an end-of-input error. How to confirm truncation, salvage complete records and decide on repair.
We send one email when a new article is published. No spam.