Re: jsonb

From: Johannes Graën <johannes(at)selfnet(dot)de>
To: hmidi slim <hmidi(dot)slim2(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: jsonb
Date: 2017-11-14 23:37:39
Message-ID: 98fad95e-e731-cf0d-f4d3-3968a945c8a4@selfnet.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 11/14/2017 11:30 PM, hmidi slim wrote:
> I'm trying to use the function to_jsonb and create the name:
> to_jsonb ('{"key1":" ' || 'text1' || '","key2":" ' || 'text2' || '"}');

This query converts a string into a JSON object that consist of that
string. I guess what you intend to accomplish is rather:

select jsonb_build_object('key1', 'text1', 'key2', 'text2');

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2017-11-14 23:38:06 Re: jsonb
Previous Message Merlin Moncure 2017-11-14 23:06:52 Re: jsonb