Re: Timstamp to Json conversion issue

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Yelai, Ramkumar IN BLR STS" <ramkumar(dot)yelai(at)siemens(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Timstamp to Json conversion issue
Date: 2015-01-13 16:00:56
Message-ID: 20664.1421164856@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Yelai, Ramkumar IN BLR STS" <ramkumar(dot)yelai(at)siemens(dot)com> writes:
> I have migrated my postgresql 9.2 schemas to Postgres 9.4 (only table scheme migrated not the data ). I have used the following sql to convert table output to json in 9.2.

> select array_to_json(array_agg(row_to_json(R.*)))::text from ( select " ID", " TIME" from "SN_TestTable" )R;

> IN 9.2, I used to get this result "[{"id":1,"time":"2015-01-13 12:09:45.348"}]"

> But same code in 9.4 produce this result "[{"id":1,"time":"2015-01-13T12:09:45.348"}]" . "T" separator is added between date and time.

This is an intentional change. As far as we know, any JSON processor that
reads timestamps should be happy with the "T", because that syntax is
required by the JSON RFC.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Robert DiFalco 2015-01-13 16:42:20 Simple Atomic Relationship Insert
Previous Message Adrian Klaver 2015-01-13 15:58:34 Re: Timstamp to Json conversion issue