When I read a record out of the database I receive a jsonb datatatype as a string.
How do I convert this string into a json object and parse and manipulate it?
Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
July 14, 2021 Manipulate and parse jasonb object in timescaledb(postgresql) | ||||
---|---|---|---|---|
| ||||
July 14, 2021 Re: Manipulate and parse jasonb object in timescaledb(postgresql) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alain De Vos | With good select operators i can extract the data i need for instance: select measurement->'room.temperature' from mytable; Now how to process that further as json object ? or jsonb object in dlang ? |
July 14, 2021 Re: Manipulate and parse jasonb object in timescaledb(postgresql) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alain De Vos | On Wednesday, 14 July 2021 at 21:56:11 UTC, Alain De Vos wrote: >With good select operators i can extract the data i need for instance: select measurement->'room.temperature' from mytable; Now how to process that further as json object ? or jsonb object in dlang ? You'll need to either lean on postgres's support for jsonb querying to avoid having to pull a jsonb string into D, or you'll have to write a jsonb library. I don't see one in dub, and it's a bit hard to search for C libraries for it that you might interface easily with (or even where the type is defined. Is it a postgres invention?) |
July 15, 2021 Re: Manipulate and parse jasonb object in timescaledb(postgresql) | ||||
---|---|---|---|---|
| ||||
Posted in reply to jfondren | As an example i show this. |
July 15, 2021 Re: Manipulate and parse jasonb object in timescaledb(postgresql) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alain De Vos | On Thursday, 15 July 2021 at 01:08:28 UTC, Alain De Vos wrote: >As an example i show this. That's JSON, not JSONB. D has JSON support in https://dlang.org/phobos/std_json.html |
July 15, 2021 Re: Manipulate and parse jasonb object in timescaledb(postgresql) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alain De Vos | On 7/14/21 9:00 AM, Alain De Vos wrote: >When I read a record out of the database I receive a jsonb datatatype as a string. Isn't jsonb just a storage assumption for the database (so it can do efficient indexing/searches)? When you get the data back, I would think it's just json data you can parse. I don't have experience with it, but I can't imagine a portable psql library that actually implements whatever binary storage format is being used inside the DB. -Steve |