Thread: quoted-printable to jsonb

quoted-printable to jsonb

From
Matt Zagrabelny
Date:
Greetings PG-users,

Scenario:

I am using FreeRADIUS to insert data to a PG database.

One of the pieces of data is an array of key value pairs. The array is encoded with quoted-printable [0].

I'd like to ideally have the key-value pair put into a JSONB field.

Here is an example of the data encoded:

mdm-tlv=3Ddevice-platform=3Dlinux-64=2Caudit-session-id=3Dc0a87311021f3000601dda71=2Cmdm-tlv=3Dac-user-agent=3DOpenConnect VPN Agent =28NetworkManager=29 v8.10-1

The =3D is an encoded "=", the =2C is an encoded ",", so forth and so on.

The encoded comma (=2C) separates the key-value pairs.

Are there any functions within PG to properly decode something like what I have into a JSONB field?

Thanks for any help!

-m