JSON / ASP.NET AJAX Dates support in PostgreSQL

Поиск
Список
Период
Сортировка
От Sebastien Flaesch
Тема JSON / ASP.NET AJAX Dates support in PostgreSQL
Дата
Msg-id DBAP191MB12896A817739B869A781C00CB0989@DBAP191MB1289.EURP191.PROD.OUTLOOK.COM
обсуждение исходный текст
Ответы Re: JSON / ASP.NET AJAX Dates support in PostgreSQL  (Ron <ronljohnsonjr@gmail.com>)
Список pgsql-general
Hello,

Is there an easy way to convert JSON data containing ASP.NET AJAX Dates into PostgreSQL timestamp?

I have this kind of JSON data:

{
    "PurchaseOrder" : "4500000000",
    "CreationDate" : "\/Date(1672358400000)\/",
    "LastChangeDateTime" : "\/Date(1672692813062+0100)\/"
}

Warning: Note the backslash before the slashes!
According to JSON spec this is valid JSON and used by AJAX Date format.


When loading that data in Firefox, the JSON visualizer shows AJAX Date values as

"/Date(1672358400000)/"

and

"/Date(1672692813062+0100)/"

(without the backslash)

My understanding is that backslash + slash = slash in JSON strings.


How can I load this record into a table defined as:

CREATE TABLE custorder (
    "PurchaseOrder" BIGINT NOT NULL PRIMARY KEY,
    "CreationDate" TIMESTAMP NOT NULL,
    "LastChangeDateTime" TIMESTAMP NOT NULL
)

?


Seb

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Unexpected behavior when combining `generated always` columns and update rules
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: "PANIC: could not open critical system index 2662" - twice