From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Marc Millas <marc(dot)millas(at)mokadb(dot)com> |
Cc: | Erik Wienhold <ewie(at)ewie(dot)name>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: missing something about json syntax |
Date: | 2023-04-20 20:41:56 |
Message-ID: | 3176185.1682023316@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Marc Millas <marc(dot)millas(at)mokadb(dot)com> writes:
> but it doesnt explain how postgres is able to put a scalar in a json or
> jsonb column without pb:
> I don't understand how this ('"{\"t\"}"') can be considered a valid enough
> json to be inserted in a json column
> and at the same time invalid for all other json uses.
That's a bare string (it's not an object). That's valid JSON per
RFC 7159:
JSON can represent four primitive types (strings, numbers, booleans,
and null) and two structured types (objects and arrays).
...
A JSON text is a serialized value. Note that certain previous
specifications of JSON constrained a JSON text to be an object or an
array.
However, there certainly are some operations that require the top-level
value to be an object or array.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Smith | 2023-04-21 00:26:27 | Re: Support logical replication of DDLs |
Previous Message | Marc Millas | 2023-04-20 19:53:29 | Re: missing something about json syntax |