Skip to content

Instantly share code, notes, and snippets.

@mshakhomirov
Created November 24, 2022 15:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mshakhomirov/aac1f93312ae305ba80c915fe4a2a386 to your computer and use it in GitHub Desktop.
Save mshakhomirov/aac1f93312ae305ba80c915fe4a2a386 to your computer and use it in GitHub Desktop.
with mytable as (
 select 1 as x, 'foo' as y, true as z union all
 select 2, 'bar', false
)
select
concat("{", "\"MyTable\":", "[", string_agg(to_json_string(t), ","), "]", "}")
from mytable as t
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment