public inbox for [email protected]
help / color / mirror / Atom feedUpper / lower case keys in JSON objects
2+ messages / 1 participants
[nested] [flat]
* Upper / lower case keys in JSON objects
@ 2025-07-25 12:26 Mark <[email protected]>
2025-07-25 12:33 ` Re: Upper / lower case keys in JSON objects Mark <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Mark @ 2025-07-25 12:26 UTC (permalink / raw)
To: pgsql-general
Hi all
Apologies for any unexpected protocol exceptions, I do not post to mailing
lists very often
I have been trying to work with JSON objects and noticed I could not get
the function json_to_record to produce results, unless I had the key values
in lower case, through testing what works.
I completed a search, but could not find any pointer (except for some front
end comments on labels being all upper or all lower case)
Could anybody comment if the postgres standard is to have key labels in
lower case?
Many thanks for any help you can provide
Mark
query:
select * from json_to_record('{"secLvl": 13, "firBal": "somethi", "firLvl":
"C", "thiLvl": "A", "fourLvl": 2}'::json) as x(seclvl int, firbal text,
firlvl text
, thilvl text, fourlvl int);
result:
seclvl | firbal | firlvl | thilvl | fourlvl
--------+--------+--------+--------+---------
| | | |
(1 row)
query:
select * from json_to_record('{"seclvl": 13, "firbal": "somethi", "firlvl":
"C", "thilvl": "A", "fourlvl": 2}'::json) as x(seclvl int, firbal text,
firlvl text
, thilvl text, fourlvl int);
result:
seclvl | firbal | firlvl | thilvl | fourlvl
--------+---------+--------+--------+---------
13 | somethi | C | A | 2
(1 row)
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Upper / lower case keys in JSON objects
2025-07-25 12:26 Upper / lower case keys in JSON objects Mark <[email protected]>
@ 2025-07-25 12:33 ` Mark <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Mark @ 2025-07-25 12:33 UTC (permalink / raw)
To: pgsql-general
Sorry all,
Figured it out, the following works:
query:
select * from json_to_record('{"secLvl": 13, "firBal": "somethi", "firLvl":
"C", "thiLvl": "A", "fourLvl": 2}'::json) as x("secLvl" int, "firBal" text,
"firLvl
" text, "thiLvl" text, "fourLvl" int);
result:
secLvl | firBal | firLvl | thiLvl | fourLvl
--------+---------+--------+--------+---------
13 | somethi | C | A | 2
(1 row)
On Fri, Jul 25, 2025 at 1:26 PM Mark <[email protected]> wrote:
> Hi all
>
> Apologies for any unexpected protocol exceptions, I do not post to mailing
> lists very often
>
> I have been trying to work with JSON objects and noticed I could not get
> the function json_to_record to produce results, unless I had the key values
> in lower case, through testing what works.
>
> I completed a search, but could not find any pointer (except for some
> front end comments on labels being all upper or all lower case)
>
> Could anybody comment if the postgres standard is to have key labels in
> lower case?
>
> Many thanks for any help you can provide
>
> Mark
>
> query:
> select * from json_to_record('{"secLvl": 13, "firBal": "somethi",
> "firLvl": "C", "thiLvl": "A", "fourLvl": 2}'::json) as x(seclvl int, firbal
> text, firlvl text
> , thilvl text, fourlvl int);
>
> result:
> seclvl | firbal | firlvl | thilvl | fourlvl
> --------+--------+--------+--------+---------
> | | | |
> (1 row)
>
>
> query:
> select * from json_to_record('{"seclvl": 13, "firbal": "somethi",
> "firlvl": "C", "thilvl": "A", "fourlvl": 2}'::json) as x(seclvl int, firbal
> text, firlvl text
> , thilvl text, fourlvl int);
>
> result:
> seclvl | firbal | firlvl | thilvl | fourlvl
> --------+---------+--------+--------+---------
> 13 | somethi | C | A | 2
> (1 row)
>
>
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2025-07-25 12:33 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-07-25 12:26 Upper / lower case keys in JSON objects Mark <[email protected]>
2025-07-25 12:33 ` Mark <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox