Dev Helpers
← Back

Unnest a list of order lines

Unnest a list of order lines using SQLite JSON functions.

Open this example in the interactive library

Source code

SELECT json_extract(value,'$.sku') AS sku,json_extract(value,'$.units') AS units FROM json_each('[{"sku":"pen","units":3},{"sku":"pad","units":1}]') ORDER BY key;

Sample output

[
  {
    "sku": "pen",
    "units": 3
  },
  {
    "sku": "pad",
    "units": 1
  }
]