public inbox for [email protected]  
help / color / mirror / Atom feed
From: Mark <[email protected]>
To: [email protected]
Subject: Upper / lower case keys in JSON objects
Date: Fri, 25 Jul 2025 13:26:16 +0100
Message-ID: <CAAm-KOuSB+mS=k3LjYLCwpkv64EpWqF8OCA=jzwCofnjyqsgXA@mail.gmail.com> (raw)

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)


view thread (2+ 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]
  Subject: Re: Upper / lower case keys in JSON objects
  In-Reply-To: <CAAm-KOuSB+mS=k3LjYLCwpkv64EpWqF8OCA=jzwCofnjyqsgXA@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