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 1rFFCO-008yyL-1N for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Dec 2023 15:06:28 +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 1rFFCM-009sfq-Me for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Dec 2023 15:06:26 +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 1rFFCM-009sfV-Cw for pgsql-hackers@lists.postgresql.org; Mon, 18 Dec 2023 15:06:26 +0000 Received: from feynman.df7cb.de ([195.49.152.168]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rFFCJ-00B11N-DC for pgsql-hackers@lists.postgresql.org; Mon, 18 Dec 2023 15:06:25 +0000 Received: from msg.df7cb.de (unknown [IPv6:2a02:908:1482:3660:b7d0:f584:a987:bc23]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) by feynman.df7cb.de (Postfix) with ESMTPSA id 4Sv37L0856z3Fxc for ; Mon, 18 Dec 2023 16:06:22 +0100 (CET) Date: Mon, 18 Dec 2023 16:06:21 +0100 From: Christoph Berg To: PostgreSQL Hackers Subject: Re: psql JSON output format Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Re: To PostgreSQL Hackers > On the command line, the format is selected by `psql --json` and `psql -J`. Among other uses, it enables easy post-processing of psql output using `jq`: $ psql -lJ | jq [ { "Name": "myon", "Owner": "myon", "Encoding": "UTF8", "Locale Provider": "libc", "Collate": "de_DE.utf8", "Ctype": "de_DE.utf8", "ICU Locale": null, "ICU Rules": null, "Access privileges": null }, ... ] Christoph