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 1ufHmJ-00504g-1j for pgsql-general@arkaria.postgresql.org; Fri, 25 Jul 2025 12:43:59 +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 1ufHmG-000Rml-Dn for pgsql-general@arkaria.postgresql.org; Fri, 25 Jul 2025 12:43:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ufHVh-000NIF-1W for pgsql-general@lists.postgresql.org; Fri, 25 Jul 2025 12:26:49 +0000 Received: from mail-oa1-x31.google.com ([2001:4860:4864:20::31]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1ufHVe-000mDn-0a for pgsql-general@postgresql.org; Fri, 25 Jul 2025 12:26:49 +0000 Received: by mail-oa1-x31.google.com with SMTP id 586e51a60fabf-2fef7f6d776so728047fac.2 for ; Fri, 25 Jul 2025 05:26:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753446405; x=1754051205; darn=postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=tsTy67FC0eLsWhzLJ/g5RdRCVg2UsaFRkS/NCXCalYY=; b=Y/857fcGVsxf8yOHq7EDGDO9+5RrF2Etc8iwPZ8XFlyhqwNm7WN/SPOCiBO3t7Lmb9 gK5jMTq05fGznYW7H/QkbZwOMUlVJBCCFKt9oa1MxCL2M4j7SbzMA06Fl264MIV5LOhW vJsaCiSq75IjPX+AEnZKBbdOunqbozj4XjCEAyNeeceYERFCEh+ZX6cFOP35Qrwtzz4s z+U/1pdOaErzM87bZw1CqRyE4GVdWVBsLoU+jZYrg5Q0occzjnaSuhyVFAwpPEQREZ0T k/jFWwx7TuMwkof4OJRYedYf2TazYIsJ3MXho4VOgxDUH/sJiZLo/vcaFfKOM9/hMhiN k5CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753446405; x=1754051205; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=tsTy67FC0eLsWhzLJ/g5RdRCVg2UsaFRkS/NCXCalYY=; b=uqG4bntfIRFtwbv4ngYTYZ7pek6XAYErJSdsGyH+1jIeS8o6VEODJyxwjKPSIiEt1x nMlaBrf8xjnhb+RmaRpn6o2sCLnKXSE4ntA8P1+cWNxMvAKpGkX1hqB3aKCl5tJtmckR EoKhEl0RqkMvgGMi1SXoOhB8oY7KCsY4h/piGoDE3r/wk3usFxVCvucltpkm1kgVenV/ TiNXkYLCZDwjmTr0Gz7Dq4v/YYMPnsBdwSwbyARGzfy/FkNJKVzJspSm8lmLWFtWkj9X Q3wBFpWs7s9GxnvSHLjTxIKDQb+PezCri+bT5CkVc9lSBDEnbB/yuFZaHH+ZsHGMaITh 4GdA== X-Gm-Message-State: AOJu0YxVk4kwosg/Qv9FmRCsSozMPzflYyMGMAdm5GVC5WJyU1EHAzRL Prsbd5zs6ApN2vDogHMJaaFscqjuoRsgBOHrdLEXUHwPL69iwhIJrC8WWpmNvRp2DKywin9U7Jk oaM14r0DrKV0q7XWb5MkdGeXTLLZLvNQ3zIGAj7hBc/XJ X-Gm-Gg: ASbGnctUUirEx6oSZO8cFttWzUNUXNviRqoLJOCVQQpvXscYpI+jxsWbXYIq4yA3HaW mPZfMpp+9wmfYZYyZWsEM3d7qkv9yx4zQ/YHHaN/wIhK5/WujsDTtDTYLt3E1suzQryAQksKPus kogxxv20OIIJ9EjWw5f4zm6tCzs+AaT6Y66rnQhRk0mRiUjdLJUSxI+Gwk5Fje9YGdzw== X-Google-Smtp-Source: AGHT+IEehICLzbzsncEq9CtOldlUeDpTxT2gRKoZ1k0jMyZDM7H7cuioQ/GVTV78sJRFVs20M0K3/Z6o9B3PnIJhPIo= X-Received: by 2002:a05:6870:b61e:b0:2e8:f5d4:607f with SMTP id 586e51a60fabf-3070202f217mr1142087fac.26.1753446405298; Fri, 25 Jul 2025 05:26:45 -0700 (PDT) MIME-Version: 1.0 From: Mark Date: Fri, 25 Jul 2025 13:26:16 +0100 X-Gm-Features: Ac12FXxhJVXbDk9UP133TZYfaEwXi3XVOO3ZSFm-nJkeS-7eJTbAlxE5jczoTh4 Message-ID: Subject: Upper / lower case keys in JSON objects To: pgsql-general@postgresql.org Content-Type: multipart/alternative; boundary="0000000000001edd7e063ac00e30" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000001edd7e063ac00e30 Content-Type: text/plain; charset="UTF-8" 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) --0000000000001edd7e063ac00e30 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi all=C2=A0

Apologies for a= ny unexpected protocol exceptions, I do not post to mailing lists very ofte= n

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)

--0000000000001edd7e063ac00e30--