[Maria-developers] Tips on Writing/Reading JSON
Hi Alexey, I'm Michael Okoko, a GSoC '21 student working on Using JSON as the on-disk format for MariaDB histograms(https://jira.mariadb.org/browse/MDEV-21130). The project requires writing and reading/parsing JSON, and I was wondering if you could provide some tips and pointers regarding a proper JSON writer/JSON parser to use. Regards, Michael.
Hello, Michael! Simple tools for reading JSON are declared in the include/mysql/service_json.h. Functions declared there are easy to use and understand, and they can read any JSON. Should be enough for you, at least to begin with. You need to look any deeper only if you have to make your code really fast, say if you're going to parse entire columns of a big tables. These 'simple' functions are used in sql/sql_acl.cc if you need an example. I didn't develop any specific tools for writing the JSON. Relied on the existing String class. Was mostly enough, just few helper functions can be found there in sql/item_jsonfunc.cc. Sergei Petrunia implemented the Json_writer class that writes the JSON, can probably be utilized for your needs. If you have any specific questions on how to parse this or get that value from the JSON - don't hesitate to ask! Best regards. HF On Wed, Jun 2, 2021 at 5:46 PM Michael Okoko <michaelsokoko@gmail.com> wrote:
Hi Alexey,
I'm Michael Okoko, a GSoC '21 student working on Using JSON as the on-disk format for MariaDB histograms(https://jira.mariadb.org/browse/MDEV-21130).
The project requires writing and reading/parsing JSON, and I was wondering if you could provide some tips and pointers regarding a proper JSON writer/JSON parser to use.
Regards, Michael.
participants (2)
-
Alexey Botchkov
-
Michael Okoko