Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ufHpe-0050tF-1i for pgsql-general@arkaria.postgresql.org; Fri, 25 Jul 2025 12:47:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ufHpd-000YHg-5h for pgsql-general@arkaria.postgresql.org; Fri, 25 Jul 2025 12:47:25 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ufHd3-000PEu-KZ for pgsql-general@lists.postgresql.org; Fri, 25 Jul 2025 12:34:26 +0000 Received: from mail-oa1-x2e.google.com ([2001:4860:4864:20::2e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1ufHd2-000ihz-07 for pgsql-general@postgresql.org; Fri, 25 Jul 2025 12:34:25 +0000 Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-2ffb85aed35so1606849fac.0 for ; Fri, 25 Jul 2025 05:34:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753446863; x=1754051663; darn=postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=JViCCRKCFZ1ACKf5rrz3ne0BESTQoURsCeEKEFjaOkY=; b=iVBlirWSXe0xGlS9hDDrZ7CNXHak90HlKKlgXxn1HN8t/jtScp61fdz6dTNUNudl/E GpcF89Y4UNyln0VvOeJlUY9BpvfZj2AFw8uanY22PZWZMM87ioCnbhPcv32OCG4iRn7E ISXO3/Pbr7lClTy37liYtA7i7uUjOTwx/AbV/3KKegWN4SQcQko4S4xZ8WNypLIZIOEi wWFacDh9PbQbk28oflWo5z4hDFh4EX3fxb/PEI82UpBaVC8WPdmlGZfTEUnIe3oXwdAw prw2LwCWkm20QK3fDyDWCD+e9LGyIkGi4zk8TyVeBLQhL/rYx9DHF8n2PL1ApEFEj1nM 0kLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753446863; x=1754051663; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=JViCCRKCFZ1ACKf5rrz3ne0BESTQoURsCeEKEFjaOkY=; b=ZyDSNPJNrW5U3YJQpvCFDpXOOPrH3C+5bqJKza0ZeKFFGMRFuFEXXDMrjj6RvimWy/ +MeXQl4fADcQRwSLk/3K1SVY0Eroz3o2EJTE9e8EsJbht9z8XhRteL6HsQrA/c+QCHzJ OoGBfv8G81Gg8/qqyTX3jtuotisosLyYSB61dyFkxvCzaRocVTyhsmgcDbLiTl9QGn+g 2pxhNL2QYExNCrhBYhrCiY9oZWLvr656p0D6OZQ7tWX987IY0DDCDx4FbCoF3ZX1UEQE g1SjL2jI+yGDbqRhQSpk0UtpRFbkhsFnwYEyi13KNdp4Rq2/W9ps4ABGUb8NJezm+EwF qJHA== X-Gm-Message-State: AOJu0Yy9/wj8EysjHoYRajVUyAcIKAmpFfjyycfzjFedF/r/vCTBnM6n bcsXy1gCwPHDxrHwbgJ+JBtYeaGsIkwYhgyetHp0ErloSTKOwadR5PbYdeIdoFA1QSwxJxAv8G0 TL4LzjrH1FBgImDfw3Qpw1o4OW8sMDV2WgHfaTqjlIH38 X-Gm-Gg: ASbGncsU2vXZyifIogEePNGJ0XFh97nEmZ8vOlOk+T4m8HMKyz/5npaec4PrjmVlwL1 DRCO/htV7Jq2e1GvYbq1hZZI/jZJsc3HpJxCdlCLvaKF0b524QluldEMUznop8G7M5ooYPS2g6X F9XSEvqn4nkQRpB+5ZO+2LSps3CiEZ3pXjJ1nemF9UuO0wV4G9db1300dZEdonzy0ySg== X-Google-Smtp-Source: AGHT+IE8urhew9eilGdk21oBp7ifQb+FRlnMpn1SqSIA5qpxOaaLTVYny2pEw9vDFIlWlxJtzzZVB7NksGCW9Ls3Pqg= X-Received: by 2002:a05:6871:6813:b0:2ea:6ea1:9625 with SMTP id 586e51a60fabf-30701fa9624mr1035378fac.31.1753446862942; Fri, 25 Jul 2025 05:34:22 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Mark Date: Fri, 25 Jul 2025 13:33:54 +0100 X-Gm-Features: Ac12FXzq4iPX-2sXKIJT7HU_ugjbor4Fjt1Lmg62vyu7AWcAzM_E7-BQylu7ZZs Message-ID: Subject: Re: Upper / lower case keys in JSON objects To: pgsql-general@postgresql.org Content-Type: multipart/alternative; boundary="00000000000065f875063ac0290b" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000065f875063ac0290b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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=E2=80=AFPM Mark wrote: > Hi all > > Apologies for any unexpected protocol exceptions, I do not post to mailin= g > 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 valu= es > 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, firb= al > 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, firb= al > text, firlvl text > , thilvl text, fourlvl int); > > result: > seclvl | firbal | firlvl | thilvl | fourlvl > --------+---------+--------+--------+--------- > 13 | somethi | C | A | 2 > (1 row) > > --00000000000065f875063ac0290b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Sorry all,=C2=A0

Figured it = out, the following works:

query:
select * from json_to_record('{"secL= vl": 13, "firBal": "somethi", "firLvl": = "C", "thiLvl": "A", "fourLvl": 2}&#= 39;::json) as x("secLvl" int, "firBal" text, "firL= vl
" text, "thiLvl" text, "fourLvl" int)= ;

result:
secLvl | firBal =C2=A0| firLvl | thiLvl | fo= urLvl =C2=A0
--------+---------+--------+--------+---------
=C2=A0=C2=A0=C2=A0=C2=A013 | somethi | C =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= | A =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0| =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A02
(1 row)





On Fri, Jul 2= 5, 2025 at 1:26=E2=80=AFPM Mark <nvpostgres@gmail.com> wrote:
Hi all=C2=A0

Apologies for any unexpected protocol exceptions, I do not post to ma= iling lists very often

I have been trying to work with JSON objects and noticed I could not get=20 the function json_to_record to produce results, unless I had the key=20 values in lower case, through testing what works.

= I completed a search, but could not find any pointer (except for some=20 front end comments on labels being all upper or all lower case)
<= br>
Could anybody comment if the postgres standard is to have key= labels in lower case?

Many thanks for any help yo= u can provide

Mark=C2=A0

= query:
select * from json_to_record('{"secLvl": 13, "firBal": &q= uot;somethi", "firLvl":=20 "C", "thiLvl": "A", "fourLvl": 2}&#= 39;::json) as x(seclvl int, firbal text,=20 firlvl text
<= /span>
, thilvl text, fourlvl in= t);

result:
seclvl | firbal | firlvl | thilvl | fourlvl =C2=A0
--------+--------+-= -------+--------+---------
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0| =C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0| =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0| =C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0| =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0<= /span>= =C2=A0
(1 row)


q= uery:
select * from json_to_record('{"seclvl": 13, "firbal": &q= uot;somethi", "firlvl":=20 "C", "thilvl": "A", "fourlvl": 2}&#= 39;::json) as x(seclvl int, firbal text,=20 firlvl text
, thilvl text, fourlvl int);

result:
seclvl | firbal =C2=A0| firlvl | thilvl | fo= urlvl =C2=A0
--------+---------+--------+--------+---------
=C2=A0=C2=A0=C2=A0=C2=A013 | somethi | C =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= | A =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0| =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A02
(1 row)

--00000000000065f875063ac0290b--