Hi,

I am generating a json with json_object() function, and I would like to
omit the null or default fields from the output json (for compacity reasons)

When there is only one such field, I have used a "case when" like in


select
   case when field2 is null then
      json_object('field1', field1)
   else
      json_object('field1', field1, 'field2', field2)
   end
...


but when there are multiple such optional fields, this approach becomes
unwieldy.

Anyone has a better idea?

Eric
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to