1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Add json_normalize function to json_lib

This patch implements a library for normalizing json documents.
The algorithm is:
* Recursively sort json keys according to utf8mb4_bin collation.
* Normalize numbers to be of the form [-]<digit>.<frac>E<exponent>
* All unneeded whitespace and line endings are removed.
* Arrays are not sorted.

Co-authored-by: Vicențiu Ciorbaru <vicentiu@mariadb.org>
This commit is contained in:
Eric Herman
2021-07-02 07:59:56 +02:00
committed by Vicențiu-Marian Ciorbaru
parent 7b587fcbe7
commit 105e4148bf
5 changed files with 1139 additions and 2 deletions

View File

@@ -1,6 +1,8 @@
#ifndef JSON_LIB_INCLUDED
#define JSON_LIB_INCLUDED
#include <my_sys.h>
#ifdef __cplusplus
extern "C" {
#endif
@@ -431,6 +433,9 @@ int json_locate_key(const char *js, const char *js_end,
const char **key_start, const char **key_end,
int *comma_pos);
int json_normalize(DYNAMIC_STRING *result,
const char *s, size_t size, CHARSET_INFO *cs);
#ifdef __cplusplus
}
#endif