Groonga
Loading...
Searching...
No Matches
json.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2025-2026 Sutou Kouhei <kou@clear-code.com>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17*/
18
19#pragma once
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
31typedef struct _grn_json_parser grn_json_parser;
32
46
60
74
81typedef struct _grn_json_reader grn_json_reader;
82
95
109
126
136GRN_API const char *
138
176
210
241
256GRN_API size_t
258
273
279typedef struct _grn_json_path grn_json_path;
280
294grn_json_path_open(grn_ctx *ctx, const char *path, int64_t path_length);
295
309
328 grn_obj *json,
329 grn_json_path *path,
330 grn_obj *values);
331
332#ifdef __cplusplus
333}
334#endif
grn_rc
Definition groonga.h:61
#define GRN_API
Definition groonga.h:39
GRN_API grn_obj * grn_json_reader_get_value(grn_ctx *ctx, grn_json_reader *reader)
Return the current value.
GRN_API grn_json_path * grn_json_path_open(grn_ctx *ctx, const char *path, int64_t path_length)
Open a new JSONPath.
GRN_API grn_json_parser * grn_json_parser_open(grn_ctx *ctx, grn_obj *input, grn_obj *output)
Open a new JSON parser.
GRN_API grn_rc grn_json_reader_close(grn_ctx *ctx, grn_json_reader *reader)
Close a JSON reader.
struct _grn_json_reader grn_json_reader
JSON reader that readers values from parses JSON (GRN_DB_JSON).
Definition json.h:81
GRN_API grn_json_reader * grn_json_reader_open(grn_ctx *ctx, grn_obj *json)
Open a new JSON reader.
GRN_API size_t grn_json_reader_get_size(grn_ctx *ctx, grn_json_reader *reader)
Return the size of the current value.
GRN_API grn_json_value_type grn_json_reader_get_type(grn_ctx *ctx, grn_json_reader *reader)
Return the current value type.
grn_json_value_type
JSON value type.
Definition json.h:115
@ GRN_JSON_VALUE_UNKNOWN
Definition json.h:116
@ GRN_JSON_VALUE_FLOAT
Definition json.h:121
@ GRN_JSON_VALUE_ARRAY
Definition json.h:123
@ GRN_JSON_VALUE_OBJECT
Definition json.h:124
@ GRN_JSON_VALUE_NULL
Definition json.h:117
@ GRN_JSON_VALUE_FALSE
Definition json.h:118
@ GRN_JSON_VALUE_STRING
Definition json.h:122
@ GRN_JSON_VALUE_TRUE
Definition json.h:119
@ GRN_JSON_VALUE_INT64
Definition json.h:120
GRN_API grn_rc grn_json_path_close(grn_ctx *ctx, grn_json_path *path)
Close a JSONPath.
GRN_API grn_rc grn_json_parser_parse(grn_ctx *ctx, grn_json_parser *parser)
Parse the given JSON text.
GRN_API grn_rc grn_json_to_string(grn_ctx *ctx, grn_obj *json, grn_obj *buffer)
Stringify parsed JSON.
GRN_API grn_rc grn_json_parser_close(grn_ctx *ctx, grn_json_parser *parser)
Close a JSON parser.
struct _grn_json_parser grn_json_parser
JSON parser that parses JSON text (GRN_DB_TEXT) and stores parsed JSON as GRN_DB_JSON.
Definition json.h:31
GRN_API grn_rc grn_json_extract(grn_ctx *ctx, grn_obj *json, grn_json_path *path, grn_obj *values)
Extract values specified by JSONPath in a parsed JSON.
GRN_API const char * grn_json_value_type_to_string(grn_json_value_type type)
Stringify grn_json_value_type.
GRN_API grn_rc grn_json_reader_next(grn_ctx *ctx, grn_json_reader *reader)
Move to the next value.
struct _grn_json_path grn_json_path
JSONPath that represents path of values in JSON.
Definition json.h:279
Definition groonga.h:351
Definition groonga.h:919