Dev Helpers
← Back

Keep only numeric dictionary values

Keep only numeric dictionary values using SQLite JSON functions.

Open this example in the interactive library

Source code

SELECT json_group_object(key,value) AS numeric_fields FROM json_each('{"min":2,"max":7,"unit":"kg"}') WHERE type IN ('integer','real');

Sample output

[
  {
    "numeric_fields": "{\"min\":2,\"max\":7}"
  }
]