zaterdag 30 maart 2019

Postgresql json datatype

https://stackoverflow.com/questions/36141388/how-can-i-get-all-keys-from-a-json-column-in-postgres

select jt.*
from (select key as key, value as valuestr, count(*) over () as metadata_aantal from json_each_text('{"Key1":"Value1", "Key2":"Value2"}'::json)) jt

https://www.postgresql.org/docs/11/functions-json.html

select * from table t where t.jsonbcolumn->'nummer' = '22420';

select id from aTable where last_message->'Gegevens'->>'prio' = '1' order by id

jsonb veld aanpassen:
SELECT '{"a":1}'::jsonb || '{"b": 1}'::jsonb;

https://stackoverflow.com/questions/18209625/how-do-i-modify-fields-inside-the-new-postgresql-json-datatype

update table set data = '{"Key1": true, "Key2": "yoho"}'::jsonb where id = 'theid001';

donderdag 7 maart 2019

C# HttpClient https without certificate

var spHandler = new HttpClientHandler()
{
      ServerCertificateCustomValidationCallback = delegate
      {
          return true;
      }
};
var hc = new System.Net.Http.HttpClient(spHandler);
var response = await hc.GetAsync("https://adress");