public inbox for [email protected]  
help / color / mirror / Atom feed
From: Victor Yegorov <[email protected]>
To: Tim McLaughlin <[email protected]>
Cc: [email protected]
Subject: Re: change JSON serialization for BIGINT?
Date: Tue, 26 Nov 2024 14:36:26 +0300
Message-ID: <CAGnEbohqVqmA6gJgKmHqANMYHNtyAxv-3U3izEUVfoKoMZp-FA@mail.gmail.com> (raw)
In-Reply-To: <536dca0f-ef1a-4621-ac1f-9c1c1dd74fbd@Spark>
References: <536dca0f-ef1a-4621-ac1f-9c1c1dd74fbd@Spark>

вт, 26 нояб. 2024 г. в 14:34, Tim McLaughlin <[email protected]>:

> Is there a way to have Postgres serialize BIGINT as a string rather than
> number in JSON?  By default it does this:
>
>
> select row_to_json(row(500::bigint));
>  row_to_json
> -------------
>  {"f1":500}
>
> But I want it to do this (note that "500" is quoted):
>
> select row_to_json(row(500::bigint));
>  row_to_json
> -------------
>  {"f1":"500"}
>

Will this work?

select row_to_json(row(500::text));

-- 
Victor Yegorov


view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: change JSON serialization for BIGINT?
  In-Reply-To: <CAGnEbohqVqmA6gJgKmHqANMYHNtyAxv-3U3izEUVfoKoMZp-FA@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox