summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorchenzizhan <[email protected]>2023-11-03 15:18:20 +0800
committerchenzizhan <[email protected]>2023-11-03 15:18:20 +0800
commit6c645be362e10eaa6e15e0b46569f43710e11494 (patch)
tree999a9d418e32718b272eb38cf06eaca31a8d4c01 /src/utils
parent4ff17defbc7df64c905210a18a9a63dd26860c3f (diff)
export with delta and readme for fs easy
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/very_fast_json_writer.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/utils/very_fast_json_writer.c b/src/utils/very_fast_json_writer.c
index e512b78..6f05464 100644
--- a/src/utils/very_fast_json_writer.c
+++ b/src/utils/very_fast_json_writer.c
@@ -61,11 +61,14 @@ void json_writer_array_start(struct json_writer *writer) {
void json_writer_array_end(struct json_writer *writer) {
if (writer->buffer[writer->cursor - 1] == '[') { // empty array
- json_writer_check_and_realloc(writer, 1);
+ json_writer_check_and_realloc(writer, 2);
writer->buffer[writer->cursor++] = ']';
+ writer->buffer[writer->cursor++] = ',';
return;
}
writer->buffer[writer->cursor - 1] = ']'; // replace last comma with ]
+ json_writer_check_and_realloc(writer, 1);
+ writer->buffer[writer->cursor++] = ',';
}
void json_writer_str_item(struct json_writer *writer, const char *value, size_t str_len) {