PostgreSQL 17's JSON_TABLE: Turn JSON Documents into Relational Rows
JSON_TABLE arrived in PostgreSQL 17 as part of expanded SQL/JSON support. It lets a query project JSON data into a relational row shape, which is helpful when importing partner payloads, reporting on semi-structured records, or joining extracted values to ordinary tables.
For example, a JSON path can expand an items array into rows and map sku and quantity values to typed columns. The useful property is that the projection becomes part of a regular SQL query, where it can be joined and filtered.
The benefit is a declarative bridge between a JSON document and SQL operations. It can reduce repeated extraction expressions and make a query easier to inspect. But a projected value still has to be validated. Decide what should happen when a path is missing, a value is null, or a partner changes the type of quantity. Test malformed and partial documents, not only the happy payload.
JSON_TABLE does not mean every nested object belongs in one JSON column forever. If a field is central to joins, constraints, authorization, or frequent updates, a normalized relational representation may still be the better contract. JSON is useful for flexible or externally shaped data; it is not an excuse to avoid defining data ownership.
Check query plans and representative row counts before using this in a high-volume endpoint. A convenient projection can still expand one event into many rows and change the cost profile. For a one-off migration or analytical query, that trade-off may be excellent; for a hot transactional path, benchmark and model the data explicitly.
See PostgreSQL’s 17 release notes and JSON functions and operators for supported syntax and behavior.