summaryrefslogtreecommitdiff
path: root/src/utils/very_fast_json_writer.h
blob: 912a580eace873e120ab5ec866fbcba2d711df47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once

#ifdef __cplusplus
extern "C" {
#endif

struct json_writer;

// #define QUOTATION_MARK \"


struct json_writer *json_writer_init();
void json_writer_start_map(struct json_writer *writer); // {
void json_writer_end_map(struct json_writer *writer); // }
void json_writer_array_start(struct json_writer *writer); // [
void json_writer_array_end(struct json_writer *writer); // ]

void json_writer_str_field(struct json_writer *writer, const char *key, const char *value, size_t str_len);
void json_writer_int_field(struct json_writer *writer, const char *key, int value);
void json_writer_double_field(struct json_writer *writer, const char *key, double value);
void json_writer_longlong_field(struct json_writer *writer, const char *key, long long value);
void json_writer_object_item(struct json_writer *writer, const char *key, struct json_writer *writer_in);
void json_writer_finish(struct json_writer *writer, char **result, size_t *result_len);
const char *json_writer_unwrap(const struct json_writer *writer);

#ifdef __cplusplus
}
#endif