From b21c02904188add942d3c7cd4885422e4335f115 Mon Sep 17 00:00:00 2001 From: ibireme Date: Mon, 8 Apr 2024 22:56:09 +0800 Subject: [PATCH] Releasing 0.9.0 --- CHANGELOG.md | 2 +- CMakeLists.txt | 2 +- doc/doxygen/html/annotated.html | 2 +- doc/doxygen/html/classes.html | 2 +- doc/doxygen/html/deprecated.html | 2 +- .../dir_68267d1309a1af8e8297ef4c3efbcdba.html | 2 +- .../dir_e68e8157741866f444e17edd764ebbae.html | 2 +- doc/doxygen/html/files.html | 2 +- doc/doxygen/html/functions.html | 2 +- doc/doxygen/html/functions_vars.html | 2 +- doc/doxygen/html/globals.html | 2 +- doc/doxygen/html/globals_defs.html | 2 +- doc/doxygen/html/globals_func.html | 2 +- doc/doxygen/html/globals_type.html | 2 +- doc/doxygen/html/globals_vars.html | 3 +- doc/doxygen/html/globals_y.html | 3 +- doc/doxygen/html/index.html | 80 ++-- doc/doxygen/html/md__c_h_a_n_g_e_l_o_g.html | 81 ++-- doc/doxygen/html/md_doc__a_p_i.html | 416 +++++++++--------- doc/doxygen/html/md_doc__build_and_test.html | 10 +- doc/doxygen/html/md_doc__data_structure.html | 16 +- doc/doxygen/html/navtreedata.js | 23 +- doc/doxygen/html/navtreeindex0.js | 12 +- doc/doxygen/html/navtreeindex1.js | 8 +- doc/doxygen/html/navtreeindex2.js | 6 +- doc/doxygen/html/pages.html | 2 +- doc/doxygen/html/search/all_10.js | 11 +- doc/doxygen/html/search/variables_e.js | 9 +- doc/doxygen/html/structyyjson__alc.html | 2 +- doc/doxygen/html/yyjson_8h.html | 163 ++++--- doc/doxygen/html/yyjson_8h.js | 1 + src/yyjson.h | 6 +- 32 files changed, 470 insertions(+), 410 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4297412..02962d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to this project will be documented in this file. -## Unreleased +## 0.9.0 (2024-04-08) #### Added - Add `YYJSON_WRITE_NEWLINE_AT_END` flag for JSON writer: #147 diff --git a/CMakeLists.txt b/CMakeLists.txt index a017b6d..1d5a073 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ # https://github.com/ibireme/yyjson/blob/master/LICENSE cmake_minimum_required(VERSION 3.5) -project(yyjson VERSION 0.8.0 LANGUAGES C) +project(yyjson VERSION 0.9.0 LANGUAGES C) set(YYJSON_SOVERSION 0) diff --git a/doc/doxygen/html/annotated.html b/doc/doxygen/html/annotated.html index f13301b..7f0b537 100644 --- a/doc/doxygen/html/annotated.html +++ b/doc/doxygen/html/annotated.html @@ -35,7 +35,7 @@ -
yyjson 0.8.0 +
yyjson 0.9.0
A high performance C JSON library.
diff --git a/doc/doxygen/html/classes.html b/doc/doxygen/html/classes.html index 1bd5d1b..a08d559 100644 --- a/doc/doxygen/html/classes.html +++ b/doc/doxygen/html/classes.html @@ -35,7 +35,7 @@ -
yyjson 0.8.0 +
yyjson 0.9.0
A high performance C JSON library.
diff --git a/doc/doxygen/html/deprecated.html b/doc/doxygen/html/deprecated.html index e78c6a1..9bff607 100644 --- a/doc/doxygen/html/deprecated.html +++ b/doc/doxygen/html/deprecated.html @@ -35,7 +35,7 @@ -
yyjson 0.8.0 +
yyjson 0.9.0
A high performance C JSON library.
diff --git a/doc/doxygen/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html b/doc/doxygen/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html index c1c14e4..e99ebba 100644 --- a/doc/doxygen/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html +++ b/doc/doxygen/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html @@ -35,7 +35,7 @@ -
yyjson 0.8.0 +
yyjson 0.9.0
A high performance C JSON library.
diff --git a/doc/doxygen/html/dir_e68e8157741866f444e17edd764ebbae.html b/doc/doxygen/html/dir_e68e8157741866f444e17edd764ebbae.html index c9b89be..a64f7d5 100644 --- a/doc/doxygen/html/dir_e68e8157741866f444e17edd764ebbae.html +++ b/doc/doxygen/html/dir_e68e8157741866f444e17edd764ebbae.html @@ -35,7 +35,7 @@ -
yyjson 0.8.0 +
yyjson 0.9.0
A high performance C JSON library.
diff --git a/doc/doxygen/html/files.html b/doc/doxygen/html/files.html index cc5e60c..41e8ae1 100644 --- a/doc/doxygen/html/files.html +++ b/doc/doxygen/html/files.html @@ -35,7 +35,7 @@ -
yyjson 0.8.0 +
yyjson 0.9.0
A high performance C JSON library.
diff --git a/doc/doxygen/html/functions.html b/doc/doxygen/html/functions.html index e8ee6cf..adb9624 100644 --- a/doc/doxygen/html/functions.html +++ b/doc/doxygen/html/functions.html @@ -35,7 +35,7 @@ -
yyjson 0.8.0 +
yyjson 0.9.0
A high performance C JSON library.
diff --git a/doc/doxygen/html/functions_vars.html b/doc/doxygen/html/functions_vars.html index c5abeba..2055fe9 100644 --- a/doc/doxygen/html/functions_vars.html +++ b/doc/doxygen/html/functions_vars.html @@ -35,7 +35,7 @@ -
yyjson 0.8.0 +
yyjson 0.9.0
A high performance C JSON library.
diff --git a/doc/doxygen/html/globals.html b/doc/doxygen/html/globals.html index 128d31a..e2250c4 100644 --- a/doc/doxygen/html/globals.html +++ b/doc/doxygen/html/globals.html @@ -35,7 +35,7 @@ -
yyjson 0.8.0 +
yyjson 0.9.0
A high performance C JSON library.
diff --git a/doc/doxygen/html/globals_defs.html b/doc/doxygen/html/globals_defs.html index c58957a..14a15bf 100644 --- a/doc/doxygen/html/globals_defs.html +++ b/doc/doxygen/html/globals_defs.html @@ -35,7 +35,7 @@ -
yyjson 0.8.0 +
yyjson 0.9.0
A high performance C JSON library.
diff --git a/doc/doxygen/html/globals_func.html b/doc/doxygen/html/globals_func.html index eea4950..c2ea82a 100644 --- a/doc/doxygen/html/globals_func.html +++ b/doc/doxygen/html/globals_func.html @@ -35,7 +35,7 @@ -
yyjson 0.8.0 +
yyjson 0.9.0
A high performance C JSON library.
diff --git a/doc/doxygen/html/globals_type.html b/doc/doxygen/html/globals_type.html index ced4aa1..1b6f556 100644 --- a/doc/doxygen/html/globals_type.html +++ b/doc/doxygen/html/globals_type.html @@ -35,7 +35,7 @@ -
yyjson 0.8.0 +
yyjson 0.9.0
A high performance C JSON library.
diff --git a/doc/doxygen/html/globals_vars.html b/doc/doxygen/html/globals_vars.html index 9c67a84..134443f 100644 --- a/doc/doxygen/html/globals_vars.html +++ b/doc/doxygen/html/globals_vars.html @@ -35,7 +35,7 @@ -
yyjson 0.8.0 +
yyjson 0.9.0
A high performance C JSON library.
@@ -146,6 +146,7 @@

- y -

  • YYJSON_WRITE_ESCAPE_SLASHES : yyjson.h
  • YYJSON_WRITE_ESCAPE_UNICODE : yyjson.h
  • YYJSON_WRITE_INF_AND_NAN_AS_NULL : yyjson.h
  • +
  • YYJSON_WRITE_NEWLINE_AT_END : yyjson.h
  • YYJSON_WRITE_NOFLAG : yyjson.h
  • YYJSON_WRITE_PRETTY : yyjson.h
  • YYJSON_WRITE_PRETTY_TWO_SPACES : yyjson.h
  • diff --git a/doc/doxygen/html/globals_y.html b/doc/doxygen/html/globals_y.html index 3c6ca33..6915355 100644 --- a/doc/doxygen/html/globals_y.html +++ b/doc/doxygen/html/globals_y.html @@ -35,7 +35,7 @@ -
    yyjson 0.8.0 +
    yyjson 0.9.0
    A high performance C JSON library.
    @@ -506,6 +506,7 @@

    - y -

    • yyjson_write_flag : yyjson.h
    • yyjson_write_fp() : yyjson.h
    • YYJSON_WRITE_INF_AND_NAN_AS_NULL : yyjson.h
    • +
    • YYJSON_WRITE_NEWLINE_AT_END : yyjson.h
    • YYJSON_WRITE_NOFLAG : yyjson.h
    • yyjson_write_opts() : yyjson.h
    • YYJSON_WRITE_PRETTY : yyjson.h
    • diff --git a/doc/doxygen/html/index.html b/doc/doxygen/html/index.html index e8e4b93..6da143c 100644 --- a/doc/doxygen/html/index.html +++ b/doc/doxygen/html/index.html @@ -35,7 +35,7 @@ -
      yyjson 0.8.0 +
      yyjson 0.9.0
      A high performance C JSON library.
      @@ -226,16 +226,16 @@

      // All functions accept NULL input, and return NULL on error.
      -
      yyjson_api_inline yyjson_val * yyjson_obj_get(yyjson_val *obj, const char *key)
      Definition: yyjson.h:5151
      -
      yyjson_api_inline int yyjson_get_int(yyjson_val *val)
      Definition: yyjson.h:4950
      -
      #define yyjson_arr_foreach(arr, idx, max, val)
      Definition: yyjson.h:1862
      -
      yyjson_api_inline const char * yyjson_get_str(yyjson_val *val)
      Definition: yyjson.h:4962
      -
      yyjson_api_inline yyjson_val * yyjson_doc_get_root(yyjson_doc *doc)
      Definition: yyjson.h:4817
      -
      yyjson_api_inline void yyjson_doc_free(yyjson_doc *doc)
      Definition: yyjson.h:4829
      -
      yyjson_api_inline size_t yyjson_get_len(yyjson_val *val)
      Definition: yyjson.h:4966
      +
      yyjson_api_inline yyjson_val * yyjson_obj_get(yyjson_val *obj, const char *key)
      Definition: yyjson.h:5156
      +
      yyjson_api_inline int yyjson_get_int(yyjson_val *val)
      Definition: yyjson.h:4955
      +
      #define yyjson_arr_foreach(arr, idx, max, val)
      Definition: yyjson.h:1866
      +
      yyjson_api_inline const char * yyjson_get_str(yyjson_val *val)
      Definition: yyjson.h:4967
      +
      yyjson_api_inline yyjson_val * yyjson_doc_get_root(yyjson_doc *doc)
      Definition: yyjson.h:4821
      +
      yyjson_api_inline void yyjson_doc_free(yyjson_doc *doc)
      Definition: yyjson.h:4833
      +
      yyjson_api_inline size_t yyjson_get_len(yyjson_val *val)
      Definition: yyjson.h:4971
      yyjson_api_inline yyjson_doc * yyjson_read(const char *dat, size_t len, yyjson_read_flag flg)
      Definition: yyjson.h:936
      -
      Definition: yyjson.h:4497
      -
      Definition: yyjson.h:4492
      +
      Definition: yyjson.h:4501
      +
      Definition: yyjson.h:4496

      Write JSON string

      // Create a mutable doc
      @@ -261,17 +261,17 @@

      // Free the doc
      -
      yyjson_api_inline bool yyjson_mut_obj_add_val(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, yyjson_mut_val *val)
      Definition: yyjson.h:6987
      -
      yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_sint32(yyjson_mut_doc *doc, const int32_t *vals, size_t count)
      Definition: yyjson.h:5958
      -
      yyjson_api_inline bool yyjson_mut_obj_add_int(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, int64_t val)
      Definition: yyjson.h:6899
      -
      yyjson_api_inline yyjson_mut_val * yyjson_mut_obj(yyjson_mut_doc *doc)
      Definition: yyjson.h:6554
      +
      yyjson_api_inline bool yyjson_mut_obj_add_val(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, yyjson_mut_val *val)
      Definition: yyjson.h:6995
      +
      yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_sint32(yyjson_mut_doc *doc, const int32_t *vals, size_t count)
      Definition: yyjson.h:5965
      +
      yyjson_api_inline bool yyjson_mut_obj_add_int(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, int64_t val)
      Definition: yyjson.h:6907
      +
      yyjson_api_inline yyjson_mut_val * yyjson_mut_obj(yyjson_mut_doc *doc)
      Definition: yyjson.h:6561
      yyjson_api void yyjson_mut_doc_free(yyjson_mut_doc *doc)
      -
      yyjson_api_inline char * yyjson_mut_write(const yyjson_mut_doc *doc, yyjson_write_flag flg, size_t *len)
      Definition: yyjson.h:1339
      -
      yyjson_api_inline void yyjson_mut_doc_set_root(yyjson_mut_doc *doc, yyjson_mut_val *root)
      Definition: yyjson.h:5373
      -
      yyjson_api_inline bool yyjson_mut_obj_add_str(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, const char *val)
      Definition: yyjson.h:6919
      +
      yyjson_api_inline char * yyjson_mut_write(const yyjson_mut_doc *doc, yyjson_write_flag flg, size_t *len)
      Definition: yyjson.h:1343
      +
      yyjson_api_inline void yyjson_mut_doc_set_root(yyjson_mut_doc *doc, yyjson_mut_val *root)
      Definition: yyjson.h:5378
      +
      yyjson_api_inline bool yyjson_mut_obj_add_str(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, const char *val)
      Definition: yyjson.h:6927
      yyjson_api yyjson_mut_doc * yyjson_mut_doc_new(const yyjson_alc *alc)
      -
      Definition: yyjson.h:5306
      -
      Definition: yyjson.h:5258
      +
      Definition: yyjson.h:5311
      +
      Definition: yyjson.h:5263

      Read JSON file with options

      // Read JSON file, allowing comments and trailing commas
      @@ -296,17 +296,17 @@

      // Free the doc
      static const yyjson_read_flag YYJSON_READ_ALLOW_TRAILING_COMMAS
      Definition: yyjson.h:758
      -
      yyjson_api_inline bool yyjson_obj_iter_init(yyjson_val *obj, yyjson_obj_iter *iter)
      Definition: yyjson.h:5176
      -
      yyjson_api_inline yyjson_val * yyjson_obj_iter_get_val(yyjson_val *key)
      Definition: yyjson.h:5209
      +
      yyjson_api_inline bool yyjson_obj_iter_init(yyjson_val *obj, yyjson_obj_iter *iter)
      Definition: yyjson.h:5181
      +
      yyjson_api_inline yyjson_val * yyjson_obj_iter_get_val(yyjson_val *key)
      Definition: yyjson.h:5214
      uint32_t yyjson_read_flag
      Definition: yyjson.h:731
      -
      yyjson_api_inline const char * yyjson_get_type_desc(yyjson_val *val)
      Definition: yyjson.h:4917
      +
      yyjson_api_inline const char * yyjson_get_type_desc(yyjson_val *val)
      Definition: yyjson.h:4922
      yyjson_read_code code
      Definition: yyjson.h:837
      -
      yyjson_api_inline yyjson_val * yyjson_obj_iter_next(yyjson_obj_iter *iter)
      Definition: yyjson.h:5199
      +
      yyjson_api_inline yyjson_val * yyjson_obj_iter_next(yyjson_obj_iter *iter)
      Definition: yyjson.h:5204
      yyjson_api yyjson_doc * yyjson_read_file(const char *path, yyjson_read_flag flg, const yyjson_alc *alc, yyjson_read_err *err)
      size_t pos
      Definition: yyjson.h:841
      const char * msg
      Definition: yyjson.h:839
      static const yyjson_read_flag YYJSON_READ_ALLOW_COMMENTS
      Definition: yyjson.h:761
      -
      Definition: yyjson.h:1930
      +
      Definition: yyjson.h:1934
      Definition: yyjson.h:835

      Write JSON file with options

      @@ -338,20 +338,20 @@

      yyjson_api yyjson_mut_doc * yyjson_doc_mut_copy(yyjson_doc *doc, const yyjson_alc *alc)
      -
      yyjson_api_inline bool yyjson_mut_is_null(yyjson_mut_val *val)
      Definition: yyjson.h:5388
      -
      const char * msg
      Definition: yyjson.h:1133
      -
      yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_iter_next(yyjson_mut_obj_iter *iter)
      Definition: yyjson.h:6488
      -
      yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_iter_remove(yyjson_mut_obj_iter *iter)
      Definition: yyjson.h:6505
      -
      yyjson_api_inline yyjson_mut_val * yyjson_mut_doc_get_root(yyjson_mut_doc *doc)
      Definition: yyjson.h:5369
      -
      yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_iter_get_val(yyjson_mut_val *key)
      Definition: yyjson.h:6500
      +
      yyjson_api_inline bool yyjson_mut_is_null(yyjson_mut_val *val)
      Definition: yyjson.h:5393
      +
      const char * msg
      Definition: yyjson.h:1137
      +
      yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_iter_next(yyjson_mut_obj_iter *iter)
      Definition: yyjson.h:6495
      +
      yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_iter_remove(yyjson_mut_obj_iter *iter)
      Definition: yyjson.h:6512
      +
      yyjson_api_inline yyjson_mut_val * yyjson_mut_doc_get_root(yyjson_mut_doc *doc)
      Definition: yyjson.h:5374
      +
      yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_iter_get_val(yyjson_mut_val *key)
      Definition: yyjson.h:6507
      static const yyjson_write_flag YYJSON_WRITE_ESCAPE_UNICODE
      Definition: yyjson.h:1076
      yyjson_api bool yyjson_mut_write_file(const char *path, const yyjson_mut_doc *doc, yyjson_write_flag flg, const yyjson_alc *alc, yyjson_write_err *err)
      -
      yyjson_api_inline bool yyjson_mut_obj_iter_init(yyjson_mut_val *obj, yyjson_mut_obj_iter *iter)
      Definition: yyjson.h:6463
      -
      yyjson_write_code code
      Definition: yyjson.h:1131
      +
      yyjson_api_inline bool yyjson_mut_obj_iter_init(yyjson_mut_val *obj, yyjson_mut_obj_iter *iter)
      Definition: yyjson.h:6470
      +
      yyjson_write_code code
      Definition: yyjson.h:1135
      static const yyjson_write_flag YYJSON_WRITE_PRETTY
      Definition: yyjson.h:1073
      uint32_t yyjson_write_flag
      Definition: yyjson.h:1063
      -
      Definition: yyjson.h:3288
      -
      Definition: yyjson.h:1129
      +
      Definition: yyjson.h:3292
      +
      Definition: yyjson.h:1133

    Documentation

    The latest (unreleased) documentation can be accessed in the doc directory. The pre-generated Doxygen HTML for the release version can be viewed here:

      @@ -379,11 +379,19 @@

      cpp-yyjson C++ C++ JSON library with a yyjson backend +reflect-cpp C++ C++ library for serialization through automated field name retrieval from structs + yyjsonr R R binding for yyjson + +Ananda Swift JSON model decoding based on yyjson + +duckdb C++ DuckDB is an in-process SQL OLAP Database Management System + +fastfetch C A neofetch-like tool for fetching system information and displaying them in a pretty way -Anada Swift JSON model decoding based on yyjson +Zrythm C Digital Audio Workstation that uses yyjson to serialize JSON project files -duckdb C++ DuckDB is an in-process SQL OLAP Database Management System +bemorehuman C Recommendation engine with a focus on uniqueness of the person receiving the rec

      TODO

      diff --git a/doc/doxygen/html/md__c_h_a_n_g_e_l_o_g.html b/doc/doxygen/html/md__c_h_a_n_g_e_l_o_g.html index 6cee035..5a38fce 100644 --- a/doc/doxygen/html/md__c_h_a_n_g_e_l_o_g.html +++ b/doc/doxygen/html/md__c_h_a_n_g_e_l_o_g.html @@ -35,7 +35,7 @@ -
      yyjson 0.8.0 +
      yyjson 0.9.0
      A high performance C JSON library.
      @@ -98,29 +98,46 @@

      All notable changes to this project will be documented in this file.

      -0.8.0 (2023-09-13)

      +0.9.0 (2024-04-08)

      Added

        +
      • Add YYJSON_WRITE_NEWLINE_AT_END flag for JSON writer: #147
      • +
      +

      +Changed

      +
        +
      • Add auto-type conversion (uint<->sint) to yyjson_ptr_get_uint/sint(): #152
      • +
      +

      +Fixed

      +
        +
      • Fix incorrect output in environments lacking native bool type support: #161
      • +
      +

      +0.8.0 (2023-09-13)

      +

      +Added

      +
      • Add YYJSON_SUBTYPE_NOESC subtype to mark strings that do not need to be escaped.
      • Add YYJSON_DISABLE_UTF8_VALIDATION flag to allow disable UTF-8 validation at compile-time.
      • Add dynamic allocator API: yyjson_alc_dyn_new(), yyjson_alc_dyn_free().
      • Add the missing yyjson_mut_obj_add_arr/obj() API: #140
      -

      +

      Changed

      • Improve the write performance of strings with YYJSON_SUBTYPE_NOESC.
      -

      +

      Fixed

      • Fix clang-16 valgrind fail: #134
      • Fix compile break when both FAST_FP and READER are disabled
      -

      +

      0.7.0 (2023-05-25)

      -

      +

      Added

      • Add YYJSON_WRITE_PRETTY_TWO_SPACES option to allow 2 spaces instead of 4 spaces when writing pretty JSON: #99
      • @@ -134,7 +151,7 @@

      • Add functions to modify JSON using JSON Pointer, such as ptr_set() and ptr_remove().
      • Add support for JSON Patch (RFC 6902).
      -

      +

      Changed

      • BREAKING CHANGE: Change the allocator's realloc function signature, add old_size parameter for custom allocator: #100
      • @@ -142,14 +159,14 @@

      • DEPRECATED: Deprecate get_pointer() functions, rename to ptr_get().
      • Improve performance of yyjson_mut_write() function.
      -

      +

      Fixed

      • Fix inaccurate error code for truncated JSON: #103
      -

      +

      0.6.0 (2022-12-12)

      -

      +

      Added

      -

      +

      Fixed

      • Fix quite NaN on MIPS and HPPA arch.
      • Fixed compile error before GCC 4.5, which doesn't support empty optional extended asm label.
      • When the built-in floating point conversion is disabled, the sprintf() output for floating point numbers is missing a decimal point, for example 123 should be 123.0.
      -

      +

      0.5.1 (2022-06-17)

      -

      +

      Fixed

      • Fix run-time error when compiling as cpp and 32-bit (g++-5 -m32 -fPIC) #85
      • Fix incurrect output number format, remove unnecessary digits (e.g. 2.0e34 -> 2e34).
      -

      +

      0.5.0 (2022-05-25)

      -

      +

      Added

      • Add LibFuzzer support.
      • @@ -187,14 +204,14 @@

      • Add YYJSON_READ_NUMBER_AS_RAW option and RAW type support.
      • Add YYJSON_READ_ALLOW_INVALID_UNICODE and YYJSON_WRITE_ALLOW_INVALID_UNICODE options to allow invalid unicode.
      -

      +

      Changed

      • Change yyjson_mut_obj_remove() return type from bool to yyjson_mut_val *.
      • Rewrite string serialization function, validate unicode encoding by default.
      • Rewrite the JSON Pointer implementation, remove internal malloc() calls.
      -

      +

      Fixed

      • Make the code work correctly with setlocale() function and -ffast-math flag: #54
      • @@ -202,9 +219,9 @@

      • Fix non null-terminated string write error.
      • Fix incorrect behavior of YYJSON_DISABLE_NON_STANDARD flag: #80
      -

      +

      0.4.0 (2021-12-12)

      -

      +

      Added

      -

      +

      Changed

      • Replace YYJSON_DISABLE_COMMENT_READER and YYJSON_DISABLE_INF_AND_NAN_READER with YYJSON_DISABLE_NON_STANDARD compile-time flag.
      • Replace YYJSON_DISABLE_FP_READER and YYJSON_DISABLE_FP_WRITER with YYJSON_DISABLE_FAST_FP_CONV compile-time flag.
      -

      +

      Fixed

      • Fix compiler warning with -Wconversion
      • Fix compiler error for GCC 4.4 (#53) and MSVC 6.0 (#55)
      -

      +

      0.3.0 (2021-05-25)

      -

      +

      Added

      • Add JSON Pointer support.
      • Add CMake install target.
      -

      +

      Changed

      • Improve performance for some architectures that don't support unaligned memory access.
      -

      +

      Fixed

      • Fix some compiler warnings for GCC and Clang.
      • Fix MSVC build error on UWP (uninitialized local variable).
      • Fix stream file reading error on some platforms.
      -

      +

      0.2.0 (2020-12-12)

      -

      +

      Added

      • Add swift package manager support.
      -

      +

      Changed

      • Improve JSON reader performance for gcc.
      • @@ -260,19 +277,19 @@

      • Rewrite double number writer with Schubfach algorithm: #4.
      • Strict UTF-8 validation for JSON reader.
      -

      +

      Removed

      • Remove YYJSON_READ_FASTFP compile-time flag.
      -

      +

      Fixed

      • Fix a compile error for old version gcc on linux: #7.
      -

      +

      0.1.0 (2020-10-26)

      -

      +

      Added

      • Initial release.
      • diff --git a/doc/doxygen/html/md_doc__a_p_i.html b/doc/doxygen/html/md_doc__a_p_i.html index 4618002..0db16bf 100644 --- a/doc/doxygen/html/md_doc__a_p_i.html +++ b/doc/doxygen/html/md_doc__a_p_i.html @@ -35,7 +35,7 @@ -
        yyjson 0.8.0 +
        yyjson 0.9.0
        A high performance C JSON library.
        @@ -122,14 +122,14 @@

        -
        yyjson_api_inline bool yyjson_is_str(yyjson_val *val)
        Definition: yyjson.h:4883
        -
        yyjson_api_inline char * yyjson_mut_write(const yyjson_mut_doc *doc, yyjson_write_flag flg, size_t *len)
        Definition: yyjson.h:1339
        -
        yyjson_api_inline char * yyjson_write(const yyjson_doc *doc, yyjson_write_flag flg, size_t *len)
        Definition: yyjson.h:1235
        -
        yyjson_api_inline bool yyjson_mut_is_str(yyjson_mut_val *val)
        Definition: yyjson.h:5424
        -
        Definition: yyjson.h:4497
        -
        Definition: yyjson.h:5306
        -
        Definition: yyjson.h:5258
        -
        Definition: yyjson.h:4492
        +
        yyjson_api_inline bool yyjson_is_str(yyjson_val *val)
        Definition: yyjson.h:4888
        +
        yyjson_api_inline char * yyjson_mut_write(const yyjson_mut_doc *doc, yyjson_write_flag flg, size_t *len)
        Definition: yyjson.h:1343
        +
        yyjson_api_inline char * yyjson_write(const yyjson_doc *doc, yyjson_write_flag flg, size_t *len)
        Definition: yyjson.h:1239
        +
        yyjson_api_inline bool yyjson_mut_is_str(yyjson_mut_val *val)
        Definition: yyjson.h:5429
        +
        Definition: yyjson.h:4501
        +
        Definition: yyjson.h:5311
        +
        Definition: yyjson.h:5263
        +
        Definition: yyjson.h:4496

        The library also provides some functions to convert values between immutable and mutable:

        // doc -> mut_doc
        @@ -152,8 +152,8 @@

        bool yyjson_equals_str(yyjson_val *val, const char *str);
        // null-terminator is optional
        bool yyjson_equals_strn(yyjson_val *val, const char *str, size_t len);
        -
        yyjson_api_inline bool yyjson_equals_str(yyjson_val *val, const char *str)
        Definition: yyjson.h:4970
        -
        yyjson_api_inline bool yyjson_equals_strn(yyjson_val *val, const char *str, size_t len)
        Definition: yyjson.h:4978
        +
        yyjson_api_inline bool yyjson_equals_str(yyjson_val *val, const char *str)
        Definition: yyjson.h:4975
        +
        yyjson_api_inline bool yyjson_equals_strn(yyjson_val *val, const char *str, size_t len)
        Definition: yyjson.h:4983

        When creating JSON, yyjson treats strings as constants for better performance. However, if your string will be modified, you should use a function with a cpy to copy the string to the document, for example:

        // reference only, null-terminated is required
        // reference only, null-terminator is optional
        @@ -163,10 +163,10 @@

        // copied, null-terminator is optional
        yyjson_mut_val *yyjson_mut_strncpy(yyjson_mut_doc *doc, const char *str, size_t len);
        -
        yyjson_api_inline yyjson_mut_val * yyjson_mut_strn(yyjson_mut_doc *doc, const char *str, size_t len)
        Definition: yyjson.h:5739
        -
        yyjson_api_inline yyjson_mut_val * yyjson_mut_strncpy(yyjson_mut_doc *doc, const char *str, size_t len)
        Definition: yyjson.h:5771
        -
        yyjson_api_inline yyjson_mut_val * yyjson_mut_strcpy(yyjson_mut_doc *doc, const char *str)
        Definition: yyjson.h:5753
        -
        yyjson_api_inline yyjson_mut_val * yyjson_mut_str(yyjson_mut_doc *doc, const char *str)
        Definition: yyjson.h:5722
        +
        yyjson_api_inline yyjson_mut_val * yyjson_mut_strn(yyjson_mut_doc *doc, const char *str, size_t len)
        Definition: yyjson.h:5745
        +
        yyjson_api_inline yyjson_mut_val * yyjson_mut_strncpy(yyjson_mut_doc *doc, const char *str, size_t len)
        Definition: yyjson.h:5777
        +
        yyjson_api_inline yyjson_mut_val * yyjson_mut_strcpy(yyjson_mut_doc *doc, const char *str)
        Definition: yyjson.h:5759
        +
        yyjson_api_inline yyjson_mut_val * yyjson_mut_str(yyjson_mut_doc *doc, const char *str)
        Definition: yyjson.h:5728


        Reading JSON

        @@ -189,7 +189,7 @@

        yyjson_doc *doc = yyjson_read(str, strlen(str), 0);
        if (doc) {...}
        -
        yyjson_api_inline void yyjson_doc_free(yyjson_doc *doc)
        Definition: yyjson.h:4829
        +
        yyjson_api_inline void yyjson_doc_free(yyjson_doc *doc)
        Definition: yyjson.h:4833

      Read JSON from file

      The path is JSON file path.
      @@ -310,7 +310,7 @@

      }
      free(dat);
      -
      yyjson_api_inline size_t yyjson_doc_get_read_size(yyjson_doc *doc)
      Definition: yyjson.h:4821
      +
      yyjson_api_inline size_t yyjson_doc_get_read_size(yyjson_doc *doc)
      Definition: yyjson.h:4825
      static const yyjson_read_flag YYJSON_READ_STOP_WHEN_DONE
      Definition: yyjson.h:754

      YYJSON_READ_ALLOW_TRAILING_COMMAS
      Allow a single trailing comma at the end of an object or array (non-standard), for example:

      @@ -342,9 +342,9 @@

      Read all numbers as raw strings without parsing. This flag is useful if you want to handle number parsing yourself. You can use the following functions to extract raw strings:

      const char *yyjson_get_raw(yyjson_val *val);
      -
      yyjson_api_inline bool yyjson_is_raw(yyjson_val *val)
      Definition: yyjson.h:4843
      -
      yyjson_api_inline const char * yyjson_get_raw(yyjson_val *val)
      Definition: yyjson.h:4934
      -
      yyjson_api_inline size_t yyjson_get_len(yyjson_val *val)
      Definition: yyjson.h:4966
      +
      yyjson_api_inline bool yyjson_is_raw(yyjson_val *val)
      Definition: yyjson.h:4848
      +
      yyjson_api_inline const char * yyjson_get_raw(yyjson_val *val)
      Definition: yyjson.h:4939
      +
      yyjson_api_inline size_t yyjson_get_len(yyjson_val *val)
      Definition: yyjson.h:4971

      YYJSON_READ_BIGNUM_AS_RAW
      Read big numbers as raw strings. This flag is useful if you want to parse these big numbers yourself. These big numbers include integers that cannot be represented by int64_t and uint64_t, and floating-point numbers that cannot be represented by finite double.

      Note that this flag will be overridden by YYJSON_READ_NUMBER_AS_RAW flag.

      @@ -374,8 +374,8 @@

      char *yyjson_val_write(const yyjson_val *val, yyjson_write_flag flg, size_t *len);
      // mut_val -> str
      char *yyjson_mut_val_write(const yyjson_mut_val *val, yyjson_write_flag flg, size_t *len);
      -
      yyjson_api_inline char * yyjson_val_write(const yyjson_val *val, yyjson_write_flag flg, size_t *len)
      Definition: yyjson.h:1444
      -
      yyjson_api_inline char * yyjson_mut_val_write(const yyjson_mut_val *val, yyjson_write_flag flg, size_t *len)
      Definition: yyjson.h:1546
      +
      yyjson_api_inline char * yyjson_val_write(const yyjson_val *val, yyjson_write_flag flg, size_t *len)
      Definition: yyjson.h:1448
      +
      yyjson_api_inline char * yyjson_mut_val_write(const yyjson_mut_val *val, yyjson_write_flag flg, size_t *len)
      Definition: yyjson.h:1550
      uint32_t yyjson_write_flag
      Definition: yyjson.h:1063

      Sample code 1:

      yyjson_doc *doc = yyjson_read("[1,2,3]", 7, 0);
      @@ -393,10 +393,10 @@

      char *json = yyjson_mut_write(doc, YYJSON_WRITE_PRETTY, NULL);
      printf("%s\n", json);
      free(json);
      -
      yyjson_api_inline void yyjson_mut_doc_set_root(yyjson_mut_doc *doc, yyjson_mut_val *root)
      Definition: yyjson.h:5373
      -
      yyjson_api_inline bool yyjson_mut_arr_add_int(yyjson_mut_doc *doc, yyjson_mut_val *arr, int64_t num)
      Definition: yyjson.h:6350
      +
      yyjson_api_inline void yyjson_mut_doc_set_root(yyjson_mut_doc *doc, yyjson_mut_val *root)
      Definition: yyjson.h:5378
      +
      yyjson_api_inline bool yyjson_mut_arr_add_int(yyjson_mut_doc *doc, yyjson_mut_val *arr, int64_t num)
      Definition: yyjson.h:6357
      yyjson_api yyjson_mut_doc * yyjson_mut_doc_new(const yyjson_alc *alc)
      -
      yyjson_api_inline yyjson_mut_val * yyjson_mut_arr(yyjson_mut_doc *doc)
      Definition: yyjson.h:5888
      +
      yyjson_api_inline yyjson_mut_val * yyjson_mut_arr(yyjson_mut_doc *doc)
      Definition: yyjson.h:5894

      Write JSON to file

      The path is output JSON file path, If the path is invalid, you will get an error. If the file is not empty, the content will be discarded.
      @@ -418,7 +418,7 @@

      yyjson_api bool yyjson_val_write_file(const char *path, const yyjson_val *val, yyjson_write_flag flg, const yyjson_alc *alc, yyjson_write_err *err)
      yyjson_api bool yyjson_mut_write_file(const char *path, const yyjson_mut_doc *doc, yyjson_write_flag flg, const yyjson_alc *alc, yyjson_write_err *err)
      yyjson_api bool yyjson_mut_val_write_file(const char *path, const yyjson_mut_val *val, yyjson_write_flag flg, const yyjson_alc *alc, yyjson_write_err *err)
      -
      Definition: yyjson.h:1129
      +
      Definition: yyjson.h:1133

Sample code:

yyjson_doc *doc = yyjson_read_file("/tmp/test.json", 0, NULL, NULL);
bool suc = yyjson_write_file("tmp/test.json", doc, YYJSON_WRITE_PRETTY, NULL, NULL);
@@ -493,10 +493,10 @@

alc.free(alc.ctx, json);
void(* free)(void *ctx, void *ptr)
Definition: yyjson.h:624
void * ctx
Definition: yyjson.h:626
-
const char * msg
Definition: yyjson.h:1133
+
const char * msg
Definition: yyjson.h:1137
yyjson_api bool yyjson_alc_pool_init(yyjson_alc *alc, void *buf, size_t size)
static const yyjson_write_flag YYJSON_WRITE_ESCAPE_UNICODE
Definition: yyjson.h:1076
-
yyjson_write_code code
Definition: yyjson.h:1131
+
yyjson_write_code code
Definition: yyjson.h:1135

Writer flag

The library provides a set of flags for JSON writer.
@@ -534,6 +534,8 @@

Allows invalid unicode when encoding string values.

Invalid characters within string values will be copied byte by byte. If YYJSON_WRITE_ESCAPE_UNICODE flag is also set, invalid characters will be escaped as \uFFFD (replacement character).

This flag does not affect the performance of correctly encoded string.

+

YYJSON_WRITE_NEWLINE_AT_END
+ Adds a newline character \n at the end of the JSON. This can be helpful for text editors or NDJSON.


Accessing JSON Document

@@ -549,8 +551,8 @@

// Get total value count in this JSON document.
// e.g. "[1,2,3]" returns 4 (1 array and 3 numbers).
-
yyjson_api_inline size_t yyjson_doc_get_val_count(yyjson_doc *doc)
Definition: yyjson.h:4825
-
yyjson_api_inline yyjson_val * yyjson_doc_get_root(yyjson_doc *doc)
Definition: yyjson.h:4817
+
yyjson_api_inline size_t yyjson_doc_get_val_count(yyjson_doc *doc)
Definition: yyjson.h:4829
+
yyjson_api_inline yyjson_val * yyjson_doc_get_root(yyjson_doc *doc)
Definition: yyjson.h:4821

A document holds all the memory for its internal values and strings. When you no longer need it, you should release the document and free up all the memory:

// Free the document; if NULL is passed in, do nothing.

@@ -620,23 +622,23 @@

bool yyjson_is_ctn(yyjson_val *val); // array/object
bool yyjson_is_raw(yyjson_val *val); // raw string
uint8_t yyjson_subtype
Definition: yyjson.h:570
-
yyjson_api_inline bool yyjson_is_ctn(yyjson_val *val)
Definition: yyjson.h:4895
-
yyjson_api_inline uint8_t yyjson_get_tag(yyjson_val *val)
Definition: yyjson.h:4913
-
yyjson_api_inline bool yyjson_is_bool(yyjson_val *val)
Definition: yyjson.h:4859
-
yyjson_api_inline bool yyjson_is_real(yyjson_val *val)
Definition: yyjson.h:4875
-
yyjson_api_inline const char * yyjson_get_type_desc(yyjson_val *val)
Definition: yyjson.h:4917
+
yyjson_api_inline bool yyjson_is_ctn(yyjson_val *val)
Definition: yyjson.h:4900
+
yyjson_api_inline uint8_t yyjson_get_tag(yyjson_val *val)
Definition: yyjson.h:4918
+
yyjson_api_inline bool yyjson_is_bool(yyjson_val *val)
Definition: yyjson.h:4864
+
yyjson_api_inline bool yyjson_is_real(yyjson_val *val)
Definition: yyjson.h:4880
+
yyjson_api_inline const char * yyjson_get_type_desc(yyjson_val *val)
Definition: yyjson.h:4922
uint8_t yyjson_type
Definition: yyjson.h:551
-
yyjson_api_inline bool yyjson_is_int(yyjson_val *val)
Definition: yyjson.h:4871
-
yyjson_api_inline bool yyjson_is_true(yyjson_val *val)
Definition: yyjson.h:4851
-
yyjson_api_inline bool yyjson_is_false(yyjson_val *val)
Definition: yyjson.h:4855
-
yyjson_api_inline yyjson_subtype yyjson_get_subtype(yyjson_val *val)
Definition: yyjson.h:4909
-
yyjson_api_inline yyjson_type yyjson_get_type(yyjson_val *val)
Definition: yyjson.h:4905
-
yyjson_api_inline bool yyjson_is_null(yyjson_val *val)
Definition: yyjson.h:4847
-
yyjson_api_inline bool yyjson_is_sint(yyjson_val *val)
Definition: yyjson.h:4867
-
yyjson_api_inline bool yyjson_is_uint(yyjson_val *val)
Definition: yyjson.h:4863
-
yyjson_api_inline bool yyjson_is_arr(yyjson_val *val)
Definition: yyjson.h:4887
-
yyjson_api_inline bool yyjson_is_num(yyjson_val *val)
Definition: yyjson.h:4879
-
yyjson_api_inline bool yyjson_is_obj(yyjson_val *val)
Definition: yyjson.h:4891
+
yyjson_api_inline bool yyjson_is_int(yyjson_val *val)
Definition: yyjson.h:4876
+
yyjson_api_inline bool yyjson_is_true(yyjson_val *val)
Definition: yyjson.h:4856
+
yyjson_api_inline bool yyjson_is_false(yyjson_val *val)
Definition: yyjson.h:4860
+
yyjson_api_inline yyjson_subtype yyjson_get_subtype(yyjson_val *val)
Definition: yyjson.h:4914
+
yyjson_api_inline yyjson_type yyjson_get_type(yyjson_val *val)
Definition: yyjson.h:4910
+
yyjson_api_inline bool yyjson_is_null(yyjson_val *val)
Definition: yyjson.h:4852
+
yyjson_api_inline bool yyjson_is_sint(yyjson_val *val)
Definition: yyjson.h:4872
+
yyjson_api_inline bool yyjson_is_uint(yyjson_val *val)
Definition: yyjson.h:4868
+
yyjson_api_inline bool yyjson_is_arr(yyjson_val *val)
Definition: yyjson.h:4892
+
yyjson_api_inline bool yyjson_is_num(yyjson_val *val)
Definition: yyjson.h:4884
+
yyjson_api_inline bool yyjson_is_obj(yyjson_val *val)
Definition: yyjson.h:4896

The following functions can be used to get the contents of the JSON value.

// Returns the raw string, or NULL if `val` is not raw type.
const char *yyjson_get_raw(yyjson_val *val);
@@ -670,13 +672,13 @@

// Returns false if input is NULL or `val` is not string.
bool yyjson_equals_str(yyjson_val *val, const char *str);
bool yyjson_equals_strn(yyjson_val *val, const char *str, size_t len);
-
yyjson_api_inline int yyjson_get_int(yyjson_val *val)
Definition: yyjson.h:4950
-
yyjson_api_inline double yyjson_get_real(yyjson_val *val)
Definition: yyjson.h:4954
-
yyjson_api_inline const char * yyjson_get_str(yyjson_val *val)
Definition: yyjson.h:4962
-
yyjson_api_inline bool yyjson_get_bool(yyjson_val *val)
Definition: yyjson.h:4938
-
yyjson_api_inline uint64_t yyjson_get_uint(yyjson_val *val)
Definition: yyjson.h:4942
-
yyjson_api_inline double yyjson_get_num(yyjson_val *val)
Definition: yyjson.h:4958
-
yyjson_api_inline int64_t yyjson_get_sint(yyjson_val *val)
Definition: yyjson.h:4946
+
yyjson_api_inline int yyjson_get_int(yyjson_val *val)
Definition: yyjson.h:4955
+
yyjson_api_inline double yyjson_get_real(yyjson_val *val)
Definition: yyjson.h:4959
+
yyjson_api_inline const char * yyjson_get_str(yyjson_val *val)
Definition: yyjson.h:4967
+
yyjson_api_inline bool yyjson_get_bool(yyjson_val *val)
Definition: yyjson.h:4943
+
yyjson_api_inline uint64_t yyjson_get_uint(yyjson_val *val)
Definition: yyjson.h:4947
+
yyjson_api_inline double yyjson_get_num(yyjson_val *val)
Definition: yyjson.h:4963
+
yyjson_api_inline int64_t yyjson_get_sint(yyjson_val *val)
Definition: yyjson.h:4951

The following functions can be used to modify the content of a JSON value.

Warning: For immutable documents, these functions will break the immutable convention, you should use this set of APIs with caution (e.g. make sure the document is only accessed in a single thread).

@@ -693,15 +695,15 @@

// The string is not copied, should be held by caller.
bool yyjson_set_str(yyjson_val *val, const char *str);
bool yyjson_set_strn(yyjson_val *val, const char *str, size_t len);
-
yyjson_api_inline bool yyjson_set_null(yyjson_val *val)
Definition: yyjson.h:5001
-
yyjson_api_inline bool yyjson_set_raw(yyjson_val *val, const char *raw, size_t len)
Definition: yyjson.h:4994
-
yyjson_api_inline bool yyjson_set_uint(yyjson_val *val, uint64_t num)
Definition: yyjson.h:5013
-
yyjson_api_inline bool yyjson_set_str(yyjson_val *val, const char *str)
Definition: yyjson.h:5037
-
yyjson_api_inline bool yyjson_set_strn(yyjson_val *val, const char *str, size_t len)
Definition: yyjson.h:5044
-
yyjson_api_inline bool yyjson_set_real(yyjson_val *val, double num)
Definition: yyjson.h:5031
-
yyjson_api_inline bool yyjson_set_sint(yyjson_val *val, int64_t num)
Definition: yyjson.h:5019
-
yyjson_api_inline bool yyjson_set_bool(yyjson_val *val, bool num)
Definition: yyjson.h:5007
-
yyjson_api_inline bool yyjson_set_int(yyjson_val *val, int num)
Definition: yyjson.h:5025
+
yyjson_api_inline bool yyjson_set_null(yyjson_val *val)
Definition: yyjson.h:5006
+
yyjson_api_inline bool yyjson_set_raw(yyjson_val *val, const char *raw, size_t len)
Definition: yyjson.h:4999
+
yyjson_api_inline bool yyjson_set_uint(yyjson_val *val, uint64_t num)
Definition: yyjson.h:5018
+
yyjson_api_inline bool yyjson_set_str(yyjson_val *val, const char *str)
Definition: yyjson.h:5042
+
yyjson_api_inline bool yyjson_set_strn(yyjson_val *val, const char *str, size_t len)
Definition: yyjson.h:5049
+
yyjson_api_inline bool yyjson_set_real(yyjson_val *val, double num)
Definition: yyjson.h:5036
+
yyjson_api_inline bool yyjson_set_sint(yyjson_val *val, int64_t num)
Definition: yyjson.h:5024
+
yyjson_api_inline bool yyjson_set_bool(yyjson_val *val, bool num)
Definition: yyjson.h:5012
+
yyjson_api_inline bool yyjson_set_int(yyjson_val *val, int num)
Definition: yyjson.h:5030

JSON Array

The following functions can be used to access a JSON array.
@@ -722,10 +724,10 @@

// Returns the last element of this array (linear search time).
// Returns NULL if array is empty or intput is not an array.
-
yyjson_api_inline size_t yyjson_arr_size(yyjson_val *arr)
Definition: yyjson.h:5058
-
yyjson_api_inline yyjson_val * yyjson_arr_get_last(yyjson_val *arr)
Definition: yyjson.h:5086
-
yyjson_api_inline yyjson_val * yyjson_arr_get(yyjson_val *arr, size_t idx)
Definition: yyjson.h:5062
-
yyjson_api_inline yyjson_val * yyjson_arr_get_first(yyjson_val *arr)
Definition: yyjson.h:5077
+
yyjson_api_inline size_t yyjson_arr_size(yyjson_val *arr)
Definition: yyjson.h:5063
+
yyjson_api_inline yyjson_val * yyjson_arr_get_last(yyjson_val *arr)
Definition: yyjson.h:5091
+
yyjson_api_inline yyjson_val * yyjson_arr_get(yyjson_val *arr, size_t idx)
Definition: yyjson.h:5067
+
yyjson_api_inline yyjson_val * yyjson_arr_get_first(yyjson_val *arr)
Definition: yyjson.h:5082

JSON Array Iterator

There are two ways to traverse an array:
@@ -737,9 +739,9 @@

while ((val = yyjson_arr_iter_next(&iter))) {
your_func(val);
}
-
yyjson_api_inline yyjson_arr_iter yyjson_arr_iter_with(yyjson_val *arr)
Definition: yyjson.h:5120
-
yyjson_api_inline yyjson_val * yyjson_arr_iter_next(yyjson_arr_iter *iter)
Definition: yyjson.h:5130
-
Definition: yyjson.h:1806
+
yyjson_api_inline yyjson_arr_iter yyjson_arr_iter_with(yyjson_val *arr)
Definition: yyjson.h:5125
+
yyjson_api_inline yyjson_val * yyjson_arr_iter_next(yyjson_arr_iter *iter)
Definition: yyjson.h:5135
+
Definition: yyjson.h:1810

Sample code 2 (foreach macro):

yyjson_val *arr; // the array to be traversed
size_t idx, max;
@@ -747,7 +749,7 @@

yyjson_arr_foreach(arr, idx, max, val) {
your_func(idx, val);
}
-
#define yyjson_arr_foreach(arr, idx, max, val)
Definition: yyjson.h:1862
+
#define yyjson_arr_foreach(arr, idx, max, val)
Definition: yyjson.h:1866


There's also mutable version API to traverse an mutable array:
@@ -762,10 +764,10 @@

}
}
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_iter_remove(yyjson_mut_arr_iter *iter)
Definition: yyjson.h:5865
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_iter_next(yyjson_mut_arr_iter *iter)
Definition: yyjson.h:5853
-
yyjson_api_inline yyjson_mut_arr_iter yyjson_mut_arr_iter_with(yyjson_mut_val *arr)
Definition: yyjson.h:5842
-
Definition: yyjson.h:2486
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_iter_remove(yyjson_mut_arr_iter *iter)
Definition: yyjson.h:5871
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_iter_next(yyjson_mut_arr_iter *iter)
Definition: yyjson.h:5859
+
yyjson_api_inline yyjson_mut_arr_iter yyjson_mut_arr_iter_with(yyjson_mut_val *arr)
Definition: yyjson.h:5848
+
Definition: yyjson.h:2490

Sample code 2 (mutable foreach macro):

yyjson_mut_val *arr; // the array to be traversed
size_t idx, max;
@@ -773,7 +775,7 @@

yyjson_mut_arr_foreach(arr, idx, max, val) {
your_func(idx, val);
}
-
#define yyjson_mut_arr_foreach(arr, idx, max, val)
Definition: yyjson.h:2556
+
#define yyjson_mut_arr_foreach(arr, idx, max, val)
Definition: yyjson.h:2560

JSON Object

The following functions can be used to access a JSON object.
@@ -796,12 +798,12 @@

-
yyjson_api_inline yyjson_val * yyjson_obj_get(yyjson_val *obj, const char *key)
Definition: yyjson.h:5151
-
yyjson_api_inline yyjson_val * yyjson_obj_iter_get(yyjson_obj_iter *iter, const char *key)
Definition: yyjson.h:5213
-
yyjson_api_inline yyjson_val * yyjson_obj_getn(yyjson_val *obj, const char *key, size_t key_len)
Definition: yyjson.h:5156
-
yyjson_api_inline yyjson_obj_iter yyjson_obj_iter_with(yyjson_val *obj)
Definition: yyjson.h:5189
-
yyjson_api_inline size_t yyjson_obj_size(yyjson_val *obj)
Definition: yyjson.h:5147
-
Definition: yyjson.h:1930
+
yyjson_api_inline yyjson_val * yyjson_obj_get(yyjson_val *obj, const char *key)
Definition: yyjson.h:5156
+
yyjson_api_inline yyjson_val * yyjson_obj_iter_get(yyjson_obj_iter *iter, const char *key)
Definition: yyjson.h:5218
+
yyjson_api_inline yyjson_val * yyjson_obj_getn(yyjson_val *obj, const char *key, size_t key_len)
Definition: yyjson.h:5161
+
yyjson_api_inline yyjson_obj_iter yyjson_obj_iter_with(yyjson_val *obj)
Definition: yyjson.h:5194
+
yyjson_api_inline size_t yyjson_obj_size(yyjson_val *obj)
Definition: yyjson.h:5152
+
Definition: yyjson.h:1934

JSON Object Iterator

There are two ways to traverse an object:
@@ -814,8 +816,8 @@

your_func(key, val);
}
-
yyjson_api_inline yyjson_val * yyjson_obj_iter_get_val(yyjson_val *key)
Definition: yyjson.h:5209
-
yyjson_api_inline yyjson_val * yyjson_obj_iter_next(yyjson_obj_iter *iter)
Definition: yyjson.h:5199
+
yyjson_api_inline yyjson_val * yyjson_obj_iter_get_val(yyjson_val *key)
Definition: yyjson.h:5214
+
yyjson_api_inline yyjson_val * yyjson_obj_iter_next(yyjson_obj_iter *iter)
Definition: yyjson.h:5204

Sample code 2 (foreach macro):

yyjson_val *obj; // this is your object
size_t idx, max;
@@ -823,7 +825,7 @@

yyjson_obj_foreach(obj, idx, max, key, val) {
your_func(key, val);
}
-
#define yyjson_obj_foreach(obj, idx, max, key, val)
Definition: yyjson.h:2033
+
#define yyjson_obj_foreach(obj, idx, max, key, val)
Definition: yyjson.h:2037


There's also mutable version API to traverse an mutable object:
@@ -839,11 +841,11 @@

}
}
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_iter_next(yyjson_mut_obj_iter *iter)
Definition: yyjson.h:6488
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_iter_remove(yyjson_mut_obj_iter *iter)
Definition: yyjson.h:6505
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_iter_get_val(yyjson_mut_val *key)
Definition: yyjson.h:6500
-
yyjson_api_inline yyjson_mut_obj_iter yyjson_mut_obj_iter_with(yyjson_mut_val *obj)
Definition: yyjson.h:6477
-
Definition: yyjson.h:3288
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_iter_next(yyjson_mut_obj_iter *iter)
Definition: yyjson.h:6495
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_iter_remove(yyjson_mut_obj_iter *iter)
Definition: yyjson.h:6512
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_iter_get_val(yyjson_mut_val *key)
Definition: yyjson.h:6507
+
yyjson_api_inline yyjson_mut_obj_iter yyjson_mut_obj_iter_with(yyjson_mut_val *obj)
Definition: yyjson.h:6484
+
Definition: yyjson.h:3292

Sample code 2 (mutable foreach macro):

yyjson_mut_val *obj; // the object to be traversed
size_t idx, max;
@@ -897,11 +899,11 @@

// Free the memory of doc and all values which is created from this doc.
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj(yyjson_mut_doc *doc)
Definition: yyjson.h:6554
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj(yyjson_mut_doc *doc)
Definition: yyjson.h:6561
yyjson_api void yyjson_mut_doc_free(yyjson_mut_doc *doc)
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_int(yyjson_mut_doc *doc, int64_t num)
Definition: yyjson.h:5704
-
yyjson_api_inline bool yyjson_mut_obj_add(yyjson_mut_val *obj, yyjson_mut_val *key, yyjson_mut_val *val)
Definition: yyjson.h:6708
-
yyjson_api_inline bool yyjson_mut_arr_append(yyjson_mut_val *arr, yyjson_mut_val *val)
Definition: yyjson.h:6109
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_int(yyjson_mut_doc *doc, int64_t num)
Definition: yyjson.h:5710
+
yyjson_api_inline bool yyjson_mut_obj_add(yyjson_mut_val *obj, yyjson_mut_val *key, yyjson_mut_val *val)
Definition: yyjson.h:6715
+
yyjson_api_inline bool yyjson_mut_arr_append(yyjson_mut_val *arr, yyjson_mut_val *val)
Definition: yyjson.h:6116

Mutable Document

The following functions are used to create, modify, copy, and destroy a JSON document.
@@ -942,7 +944,7 @@

yyjson_api yyjson_mut_val * yyjson_mut_val_mut_copy(yyjson_mut_doc *doc, yyjson_mut_val *val)
yyjson_api yyjson_mut_doc * yyjson_mut_doc_mut_copy(yyjson_mut_doc *doc, const yyjson_alc *alc)
yyjson_api bool yyjson_mut_doc_set_val_pool_size(yyjson_mut_doc *doc, size_t count)
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_doc_get_root(yyjson_mut_doc *doc)
Definition: yyjson.h:5369
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_doc_get_root(yyjson_mut_doc *doc)
Definition: yyjson.h:5374
yyjson_api bool yyjson_mut_doc_set_str_pool_size(yyjson_mut_doc *doc, size_t len)

JSON Value Creation

@@ -965,13 +967,13 @@

// Creates a string value, the input string is copied and held by the document.
yyjson_mut_val *yyjson_mut_strncpy(yyjson_mut_doc *doc, const char *str, size_t len);
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_true(yyjson_mut_doc *doc)
Definition: yyjson.h:5644
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_real(yyjson_mut_doc *doc, double num)
Definition: yyjson.h:5709
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_false(yyjson_mut_doc *doc)
Definition: yyjson.h:5655
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_bool(yyjson_mut_doc *doc, bool val)
Definition: yyjson.h:5666
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_null(yyjson_mut_doc *doc)
Definition: yyjson.h:5633
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_uint(yyjson_mut_doc *doc, uint64_t num)
Definition: yyjson.h:5678
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_sint(yyjson_mut_doc *doc, int64_t num)
Definition: yyjson.h:5691
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_true(yyjson_mut_doc *doc)
Definition: yyjson.h:5649
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_real(yyjson_mut_doc *doc, double num)
Definition: yyjson.h:5715
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_false(yyjson_mut_doc *doc)
Definition: yyjson.h:5660
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_bool(yyjson_mut_doc *doc, bool val)
Definition: yyjson.h:5671
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_null(yyjson_mut_doc *doc)
Definition: yyjson.h:5638
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_uint(yyjson_mut_doc *doc, uint64_t num)
Definition: yyjson.h:5684
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_sint(yyjson_mut_doc *doc, int64_t num)
Definition: yyjson.h:5697

JSON Array Creation

The following functions are used to create mutable JSON array.
@@ -1007,24 +1009,24 @@

// sample code:
const char strs[3] = {"Jan", "Feb", "Mar"};
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_sint(yyjson_mut_doc *doc, const int64_t *vals, size_t count)
Definition: yyjson.h:5927
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_uint8(yyjson_mut_doc *doc, const uint8_t *vals, size_t count)
Definition: yyjson.h:5974
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_sint64(yyjson_mut_doc *doc, const int64_t *vals, size_t count)
Definition: yyjson.h:5966
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_strn(yyjson_mut_doc *doc, const char **vals, const size_t *lens, size_t count)
Definition: yyjson.h:6032
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_float(yyjson_mut_doc *doc, const float *vals, size_t count)
Definition: yyjson.h:6006
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_sint32(yyjson_mut_doc *doc, const int32_t *vals, size_t count)
Definition: yyjson.h:5958
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_real(yyjson_mut_doc *doc, const double *vals, size_t count)
Definition: yyjson.h:5937
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_sint16(yyjson_mut_doc *doc, const int16_t *vals, size_t count)
Definition: yyjson.h:5950
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_uint16(yyjson_mut_doc *doc, const uint16_t *vals, size_t count)
Definition: yyjson.h:5982
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_strcpy(yyjson_mut_doc *doc, const char **vals, size_t count)
Definition: yyjson.h:6042
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_uint64(yyjson_mut_doc *doc, const uint64_t *vals, size_t count)
Definition: yyjson.h:5998
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_uint(yyjson_mut_doc *doc, const uint64_t *vals, size_t count)
Definition: yyjson.h:5932
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_sint8(yyjson_mut_doc *doc, const int8_t *vals, size_t count)
Definition: yyjson.h:5942
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_uint32(yyjson_mut_doc *doc, const uint32_t *vals, size_t count)
Definition: yyjson.h:5990
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_double(yyjson_mut_doc *doc, const double *vals, size_t count)
Definition: yyjson.h:6014
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_strncpy(yyjson_mut_doc *doc, const char **vals, const size_t *lens, size_t count)
Definition: yyjson.h:6056
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_str(yyjson_mut_doc *doc, const char **vals, size_t count)
Definition: yyjson.h:6022
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_bool(yyjson_mut_doc *doc, const bool *vals, size_t count)
Definition: yyjson.h:5920
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_sint(yyjson_mut_doc *doc, const int64_t *vals, size_t count)
Definition: yyjson.h:5934
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_uint8(yyjson_mut_doc *doc, const uint8_t *vals, size_t count)
Definition: yyjson.h:5981
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_sint64(yyjson_mut_doc *doc, const int64_t *vals, size_t count)
Definition: yyjson.h:5973
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_strn(yyjson_mut_doc *doc, const char **vals, const size_t *lens, size_t count)
Definition: yyjson.h:6039
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_float(yyjson_mut_doc *doc, const float *vals, size_t count)
Definition: yyjson.h:6013
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_sint32(yyjson_mut_doc *doc, const int32_t *vals, size_t count)
Definition: yyjson.h:5965
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_real(yyjson_mut_doc *doc, const double *vals, size_t count)
Definition: yyjson.h:5944
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_sint16(yyjson_mut_doc *doc, const int16_t *vals, size_t count)
Definition: yyjson.h:5957
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_uint16(yyjson_mut_doc *doc, const uint16_t *vals, size_t count)
Definition: yyjson.h:5989
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_strcpy(yyjson_mut_doc *doc, const char **vals, size_t count)
Definition: yyjson.h:6049
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_uint64(yyjson_mut_doc *doc, const uint64_t *vals, size_t count)
Definition: yyjson.h:6005
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_uint(yyjson_mut_doc *doc, const uint64_t *vals, size_t count)
Definition: yyjson.h:5939
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_sint8(yyjson_mut_doc *doc, const int8_t *vals, size_t count)
Definition: yyjson.h:5949
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_uint32(yyjson_mut_doc *doc, const uint32_t *vals, size_t count)
Definition: yyjson.h:5997
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_double(yyjson_mut_doc *doc, const double *vals, size_t count)
Definition: yyjson.h:6021
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_strncpy(yyjson_mut_doc *doc, const char **vals, const size_t *lens, size_t count)
Definition: yyjson.h:6063
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_str(yyjson_mut_doc *doc, const char **vals, size_t count)
Definition: yyjson.h:6029
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_bool(yyjson_mut_doc *doc, const bool *vals, size_t count)
Definition: yyjson.h:5926

JSON Array Modification

The following functions are used to modify the contents of a JSON array.
@@ -1086,28 +1088,28 @@

// Creates and adds a new object at the end of the array.
// Returns the new object, or NULL on error.
-
yyjson_api_inline bool yyjson_mut_arr_add_str(yyjson_mut_doc *doc, yyjson_mut_val *arr, const char *str)
Definition: yyjson.h:6370
-
yyjson_api_inline bool yyjson_mut_arr_add_true(yyjson_mut_doc *doc, yyjson_mut_val *arr)
Definition: yyjson.h:6302
-
yyjson_api_inline bool yyjson_mut_arr_prepend(yyjson_mut_val *arr, yyjson_mut_val *val)
Definition: yyjson.h:6128
-
yyjson_api_inline bool yyjson_mut_arr_add_strncpy(yyjson_mut_doc *doc, yyjson_mut_val *arr, const char *str, size_t len)
Definition: yyjson.h:6400
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_remove(yyjson_mut_val *arr, size_t idx)
Definition: yyjson.h:6175
-
yyjson_api_inline bool yyjson_mut_arr_clear(yyjson_mut_val *arr)
Definition: yyjson.h:6262
-
yyjson_api_inline bool yyjson_mut_arr_add_strcpy(yyjson_mut_doc *doc, yyjson_mut_val *arr, const char *str)
Definition: yyjson.h:6390
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_replace(yyjson_mut_val *arr, size_t idx, yyjson_mut_val *val)
Definition: yyjson.h:6147
-
yyjson_api_inline bool yyjson_mut_arr_add_bool(yyjson_mut_doc *doc, yyjson_mut_val *arr, bool val)
Definition: yyjson.h:6320
-
yyjson_api_inline bool yyjson_mut_arr_add_uint(yyjson_mut_doc *doc, yyjson_mut_val *arr, uint64_t num)
Definition: yyjson.h:6330
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_add_arr(yyjson_mut_doc *doc, yyjson_mut_val *arr)
Definition: yyjson.h:6410
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_remove_last(yyjson_mut_val *arr)
Definition: yyjson.h:6218
-
yyjson_api_inline bool yyjson_mut_arr_add_false(yyjson_mut_doc *doc, yyjson_mut_val *arr)
Definition: yyjson.h:6311
-
yyjson_api_inline bool yyjson_mut_arr_add_strn(yyjson_mut_doc *doc, yyjson_mut_val *arr, const char *str, size_t len)
Definition: yyjson.h:6380
-
yyjson_api_inline bool yyjson_mut_arr_add_real(yyjson_mut_doc *doc, yyjson_mut_val *arr, double num)
Definition: yyjson.h:6360
-
yyjson_api_inline bool yyjson_mut_arr_add_val(yyjson_mut_val *arr, yyjson_mut_val *val)
Definition: yyjson.h:6288
-
yyjson_api_inline bool yyjson_mut_arr_add_sint(yyjson_mut_doc *doc, yyjson_mut_val *arr, int64_t num)
Definition: yyjson.h:6340
-
yyjson_api_inline bool yyjson_mut_arr_remove_range(yyjson_mut_val *arr, size_t idx, size_t len)
Definition: yyjson.h:6240
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_add_obj(yyjson_mut_doc *doc, yyjson_mut_val *arr)
Definition: yyjson.h:6419
-
yyjson_api_inline bool yyjson_mut_arr_insert(yyjson_mut_val *arr, yyjson_mut_val *val, size_t idx)
Definition: yyjson.h:6078
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_remove_first(yyjson_mut_val *arr)
Definition: yyjson.h:6199
-
yyjson_api_inline bool yyjson_mut_arr_add_null(yyjson_mut_doc *doc, yyjson_mut_val *arr)
Definition: yyjson.h:6293
+
yyjson_api_inline bool yyjson_mut_arr_add_str(yyjson_mut_doc *doc, yyjson_mut_val *arr, const char *str)
Definition: yyjson.h:6377
+
yyjson_api_inline bool yyjson_mut_arr_add_true(yyjson_mut_doc *doc, yyjson_mut_val *arr)
Definition: yyjson.h:6309
+
yyjson_api_inline bool yyjson_mut_arr_prepend(yyjson_mut_val *arr, yyjson_mut_val *val)
Definition: yyjson.h:6135
+
yyjson_api_inline bool yyjson_mut_arr_add_strncpy(yyjson_mut_doc *doc, yyjson_mut_val *arr, const char *str, size_t len)
Definition: yyjson.h:6407
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_remove(yyjson_mut_val *arr, size_t idx)
Definition: yyjson.h:6182
+
yyjson_api_inline bool yyjson_mut_arr_clear(yyjson_mut_val *arr)
Definition: yyjson.h:6269
+
yyjson_api_inline bool yyjson_mut_arr_add_strcpy(yyjson_mut_doc *doc, yyjson_mut_val *arr, const char *str)
Definition: yyjson.h:6397
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_replace(yyjson_mut_val *arr, size_t idx, yyjson_mut_val *val)
Definition: yyjson.h:6154
+
yyjson_api_inline bool yyjson_mut_arr_add_bool(yyjson_mut_doc *doc, yyjson_mut_val *arr, bool val)
Definition: yyjson.h:6327
+
yyjson_api_inline bool yyjson_mut_arr_add_uint(yyjson_mut_doc *doc, yyjson_mut_val *arr, uint64_t num)
Definition: yyjson.h:6337
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_add_arr(yyjson_mut_doc *doc, yyjson_mut_val *arr)
Definition: yyjson.h:6417
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_remove_last(yyjson_mut_val *arr)
Definition: yyjson.h:6225
+
yyjson_api_inline bool yyjson_mut_arr_add_false(yyjson_mut_doc *doc, yyjson_mut_val *arr)
Definition: yyjson.h:6318
+
yyjson_api_inline bool yyjson_mut_arr_add_strn(yyjson_mut_doc *doc, yyjson_mut_val *arr, const char *str, size_t len)
Definition: yyjson.h:6387
+
yyjson_api_inline bool yyjson_mut_arr_add_real(yyjson_mut_doc *doc, yyjson_mut_val *arr, double num)
Definition: yyjson.h:6367
+
yyjson_api_inline bool yyjson_mut_arr_add_val(yyjson_mut_val *arr, yyjson_mut_val *val)
Definition: yyjson.h:6295
+
yyjson_api_inline bool yyjson_mut_arr_add_sint(yyjson_mut_doc *doc, yyjson_mut_val *arr, int64_t num)
Definition: yyjson.h:6347
+
yyjson_api_inline bool yyjson_mut_arr_remove_range(yyjson_mut_val *arr, size_t idx, size_t len)
Definition: yyjson.h:6247
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_add_obj(yyjson_mut_doc *doc, yyjson_mut_val *arr)
Definition: yyjson.h:6426
+
yyjson_api_inline bool yyjson_mut_arr_insert(yyjson_mut_val *arr, yyjson_mut_val *val, size_t idx)
Definition: yyjson.h:6085
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_remove_first(yyjson_mut_val *arr)
Definition: yyjson.h:6206
+
yyjson_api_inline bool yyjson_mut_arr_add_null(yyjson_mut_doc *doc, yyjson_mut_val *arr)
Definition: yyjson.h:6300

JSON Object Creation

The following functions are used to create mutable JSON object.
@@ -1136,8 +1138,8 @@

// sample code:
const char *pairs[] = {"name", "Harry", "type", "student", "id", "123456"};
yyjson_mut_obj_with_kv(doc, pairs, 3);
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_with_str(yyjson_mut_doc *doc, const char **keys, const char **vals, size_t count)
Definition: yyjson.h:6565
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_with_kv(yyjson_mut_doc *doc, const char **kv_pairs, size_t pair_count)
Definition: yyjson.h:6596
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_with_str(yyjson_mut_doc *doc, const char **keys, const char **vals, size_t count)
Definition: yyjson.h:6572
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_with_kv(yyjson_mut_doc *doc, const char **kv_pairs, size_t pair_count)
Definition: yyjson.h:6603

JSON Object Modification

The following functions are used to modify the contents of a JSON object.
@@ -1190,28 +1192,28 @@

// This function takes a linear search time.
yyjson_api_inline bool yyjson_mut_obj_rename_key(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, const char *new_key);
yyjson_api_inline bool yyjson_mut_obj_rename_keyn(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, size_t len, const char *new_key, size_t new_len);
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_add_arr(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key)
Definition: yyjson.h:6971
-
yyjson_api_inline bool yyjson_mut_obj_add_strncpy(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, const char *val, size_t len)
Definition: yyjson.h:6958
-
yyjson_api_inline bool yyjson_mut_obj_rename_keyn(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, size_t len, const char *new_key, size_t new_len)
Definition: yyjson.h:7029
-
yyjson_api_inline bool yyjson_mut_obj_add_sint(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, int64_t val)
Definition: yyjson.h:6889
-
yyjson_api_inline bool yyjson_mut_obj_add_strn(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, const char *val, size_t len)
Definition: yyjson.h:6933
-
yyjson_api_inline bool yyjson_mut_obj_add_false(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key)
Definition: yyjson.h:6862
-
yyjson_api_inline bool yyjson_mut_obj_add_int(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, int64_t val)
Definition: yyjson.h:6899
-
yyjson_api_inline bool yyjson_mut_obj_add_uint(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, uint64_t val)
Definition: yyjson.h:6879
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_remove_str(yyjson_mut_val *obj, const char *key)
Definition: yyjson.h:6997
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_remove(yyjson_mut_val *obj, yyjson_mut_val *key)
Definition: yyjson.h:6767
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_add_arr(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key)
Definition: yyjson.h:6979
+
yyjson_api_inline bool yyjson_mut_obj_add_strncpy(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, const char *val, size_t len)
Definition: yyjson.h:6966
+
yyjson_api_inline bool yyjson_mut_obj_rename_keyn(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, size_t len, const char *new_key, size_t new_len)
Definition: yyjson.h:7037
+
yyjson_api_inline bool yyjson_mut_obj_add_sint(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, int64_t val)
Definition: yyjson.h:6897
+
yyjson_api_inline bool yyjson_mut_obj_add_strn(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, const char *val, size_t len)
Definition: yyjson.h:6941
+
yyjson_api_inline bool yyjson_mut_obj_add_false(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key)
Definition: yyjson.h:6869
+
yyjson_api_inline bool yyjson_mut_obj_add_int(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, int64_t val)
Definition: yyjson.h:6907
+
yyjson_api_inline bool yyjson_mut_obj_add_uint(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, uint64_t val)
Definition: yyjson.h:6887
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_remove_str(yyjson_mut_val *obj, const char *key)
Definition: yyjson.h:7005
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_remove(yyjson_mut_val *obj, yyjson_mut_val *key)
Definition: yyjson.h:6774
#define yyjson_api_inline
Definition: yyjson.h:372
-
yyjson_api_inline bool yyjson_mut_obj_add_null(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key)
Definition: yyjson.h:6846
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_add_obj(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key)
Definition: yyjson.h:6979
-
yyjson_api_inline bool yyjson_mut_obj_add_true(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key)
Definition: yyjson.h:6854
-
yyjson_api_inline bool yyjson_mut_obj_add_str(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, const char *val)
Definition: yyjson.h:6919
-
yyjson_api_inline bool yyjson_mut_obj_add_real(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, double val)
Definition: yyjson.h:6909
-
yyjson_api_inline bool yyjson_mut_obj_add_bool(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, bool val)
Definition: yyjson.h:6870
-
yyjson_api_inline bool yyjson_mut_obj_add_strcpy(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, const char *val)
Definition: yyjson.h:6945
-
yyjson_api_inline bool yyjson_mut_obj_put(yyjson_mut_val *obj, yyjson_mut_val *key, yyjson_mut_val *val)
Definition: yyjson.h:6719
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_remove_strn(yyjson_mut_val *obj, const char *key, size_t len)
Definition: yyjson.h:7002
-
yyjson_api_inline bool yyjson_mut_obj_rename_key(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, const char *new_key)
Definition: yyjson.h:7020
-
yyjson_api_inline bool yyjson_mut_obj_clear(yyjson_mut_val *obj)
Definition: yyjson.h:6793
+
yyjson_api_inline bool yyjson_mut_obj_add_null(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key)
Definition: yyjson.h:6853
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_add_obj(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key)
Definition: yyjson.h:6987
+
yyjson_api_inline bool yyjson_mut_obj_add_true(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key)
Definition: yyjson.h:6861
+
yyjson_api_inline bool yyjson_mut_obj_add_str(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, const char *val)
Definition: yyjson.h:6927
+
yyjson_api_inline bool yyjson_mut_obj_add_real(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, double val)
Definition: yyjson.h:6917
+
yyjson_api_inline bool yyjson_mut_obj_add_bool(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, bool val)
Definition: yyjson.h:6877
+
yyjson_api_inline bool yyjson_mut_obj_add_strcpy(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, const char *val)
Definition: yyjson.h:6953
+
yyjson_api_inline bool yyjson_mut_obj_put(yyjson_mut_val *obj, yyjson_mut_val *key, yyjson_mut_val *val)
Definition: yyjson.h:6726
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_remove_strn(yyjson_mut_val *obj, const char *key, size_t len)
Definition: yyjson.h:7010
+
yyjson_api_inline bool yyjson_mut_obj_rename_key(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, const char *new_key)
Definition: yyjson.h:7028
+
yyjson_api_inline bool yyjson_mut_obj_clear(yyjson_mut_val *obj)
Definition: yyjson.h:6800

JSON Pointer and Patch

@@ -1235,20 +1237,20 @@

yyjson_val *yyjson_doc_ptr_getx(yyjson_doc *doc, const char *ptr, size_t len, yyjson_ptr_err *err);
yyjson_mut_val *yyjson_mut_ptr_getx(yyjson_mut_val *val, const char *ptr, size_t len, yyjson_ptr_ctx *ctx, yyjson_ptr_err *err);
yyjson_mut_val *yyjson_mut_doc_ptr_getx(yyjson_mut_doc *doc, const char *ptr, size_t len, yyjson_ptr_ctx *ctx, yyjson_ptr_err *err);
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_doc_ptr_getn(yyjson_mut_doc *doc, const char *ptr, size_t len)
Definition: yyjson.h:7167
-
yyjson_api_inline yyjson_val * yyjson_ptr_getx(yyjson_val *val, const char *ptr, size_t len, yyjson_ptr_err *err)
Definition: yyjson.h:7143
-
yyjson_api_inline yyjson_val * yyjson_doc_ptr_getx(yyjson_doc *doc, const char *ptr, size_t len, yyjson_ptr_err *err)
Definition: yyjson.h:7110
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_doc_ptr_get(yyjson_mut_doc *doc, const char *ptr)
Definition: yyjson.h:7161
-
yyjson_api_inline yyjson_val * yyjson_doc_ptr_getn(yyjson_doc *doc, const char *ptr, size_t len)
Definition: yyjson.h:7105
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_doc_ptr_getx(yyjson_mut_doc *doc, const char *ptr, size_t len, yyjson_ptr_ctx *ctx, yyjson_ptr_err *err)
Definition: yyjson.h:7173
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_ptr_getn(yyjson_mut_val *val, const char *ptr, size_t len)
Definition: yyjson.h:7205
-
yyjson_api_inline yyjson_val * yyjson_ptr_get(yyjson_val *val, const char *ptr)
Definition: yyjson.h:7132
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_ptr_get(yyjson_mut_val *val, const char *ptr)
Definition: yyjson.h:7199
-
yyjson_api_inline yyjson_val * yyjson_doc_ptr_get(yyjson_doc *doc, const char *ptr)
Definition: yyjson.h:7099
-
yyjson_api_inline yyjson_val * yyjson_ptr_getn(yyjson_val *val, const char *ptr, size_t len)
Definition: yyjson.h:7138
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_ptr_getx(yyjson_mut_val *val, const char *ptr, size_t len, yyjson_ptr_ctx *ctx, yyjson_ptr_err *err)
Definition: yyjson.h:7211
-
Definition: yyjson.h:3849
-
Definition: yyjson.h:3821
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_doc_ptr_getn(yyjson_mut_doc *doc, const char *ptr, size_t len)
Definition: yyjson.h:7175
+
yyjson_api_inline yyjson_val * yyjson_ptr_getx(yyjson_val *val, const char *ptr, size_t len, yyjson_ptr_err *err)
Definition: yyjson.h:7151
+
yyjson_api_inline yyjson_val * yyjson_doc_ptr_getx(yyjson_doc *doc, const char *ptr, size_t len, yyjson_ptr_err *err)
Definition: yyjson.h:7118
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_doc_ptr_get(yyjson_mut_doc *doc, const char *ptr)
Definition: yyjson.h:7169
+
yyjson_api_inline yyjson_val * yyjson_doc_ptr_getn(yyjson_doc *doc, const char *ptr, size_t len)
Definition: yyjson.h:7113
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_doc_ptr_getx(yyjson_mut_doc *doc, const char *ptr, size_t len, yyjson_ptr_ctx *ctx, yyjson_ptr_err *err)
Definition: yyjson.h:7181
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_ptr_getn(yyjson_mut_val *val, const char *ptr, size_t len)
Definition: yyjson.h:7213
+
yyjson_api_inline yyjson_val * yyjson_ptr_get(yyjson_val *val, const char *ptr)
Definition: yyjson.h:7140
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_ptr_get(yyjson_mut_val *val, const char *ptr)
Definition: yyjson.h:7207
+
yyjson_api_inline yyjson_val * yyjson_doc_ptr_get(yyjson_doc *doc, const char *ptr)
Definition: yyjson.h:7107
+
yyjson_api_inline yyjson_val * yyjson_ptr_getn(yyjson_val *val, const char *ptr, size_t len)
Definition: yyjson.h:7146
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_ptr_getx(yyjson_mut_val *val, const char *ptr, size_t len, yyjson_ptr_ctx *ctx, yyjson_ptr_err *err)
Definition: yyjson.h:7219
+
Definition: yyjson.h:3853
+
Definition: yyjson.h:3825

For example, given the JSON document:

{
"size" : 3,
"users" : [
@@ -1283,8 +1285,8 @@

yyjson_val *val2 = yyjson_doc_ptr_getx(doc, "/", 1, &err);
if (!val2) printf("err %d: %s\n", err.code, err.msg); // err 3: cannot be resolved
-
const char * msg
Definition: yyjson.h:3825
-
yyjson_ptr_code code
Definition: yyjson.h:3823
+
const char * msg
Definition: yyjson.h:3829
+
yyjson_ptr_code code
Definition: yyjson.h:3827

The library also supports modifying JSON values using JSON Pointer.

// Add or insert a new value.
bool yyjson_mut_ptr_add(yyjson_mut_val *val, const char *ptr, yyjson_mut_val *new_val, yyjson_mut_doc *doc);
bool yyjson_mut_ptr_addn(yyjson_mut_val *val, const char *ptr, size_t len, yyjson_mut_val *new_val, yyjson_mut_doc *doc);
@@ -1320,30 +1322,30 @@

yyjson_mut_val *yyjson_mut_doc_ptr_removen(yyjson_mut_doc *doc, const char *ptr, size_t len);
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_doc_ptr_remove(yyjson_mut_doc *doc, const char *ptr)
Definition: yyjson.h:7519
-
yyjson_api_inline bool yyjson_mut_ptr_setx(yyjson_mut_val *val, const char *ptr, size_t len, yyjson_mut_val *new_val, yyjson_mut_doc *doc, bool create_parent, yyjson_ptr_ctx *ctx, yyjson_ptr_err *err)
Definition: yyjson.h:7413
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_doc_ptr_replace(yyjson_mut_doc *doc, const char *ptr, yyjson_mut_val *new_val)
Definition: yyjson.h:7442
-
yyjson_api_inline bool yyjson_mut_doc_ptr_setn(yyjson_mut_doc *doc, const char *ptr, size_t len, yyjson_mut_val *new_val)
Definition: yyjson.h:7342
-
yyjson_api_inline bool yyjson_mut_ptr_addx(yyjson_mut_val *val, const char *ptr, size_t len, yyjson_mut_val *new_val, yyjson_mut_doc *doc, bool create_parent, yyjson_ptr_ctx *ctx, yyjson_ptr_err *err)
Definition: yyjson.h:7309
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_doc_ptr_removex(yyjson_mut_doc *doc, const char *ptr, size_t len, yyjson_ptr_ctx *ctx, yyjson_ptr_err *err)
Definition: yyjson.h:7530
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_ptr_removen(yyjson_mut_val *val, const char *ptr, size_t len)
Definition: yyjson.h:7564
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_ptr_replacex(yyjson_mut_val *val, const char *ptr, size_t len, yyjson_mut_val *new_val, yyjson_ptr_ctx *ctx, yyjson_ptr_err *err)
Definition: yyjson.h:7497
-
yyjson_api_inline bool yyjson_mut_doc_ptr_setx(yyjson_mut_doc *doc, const char *ptr, size_t len, yyjson_mut_val *new_val, bool create_parent, yyjson_ptr_ctx *ctx, yyjson_ptr_err *err)
Definition: yyjson.h:7348
-
yyjson_api_inline bool yyjson_mut_ptr_set(yyjson_mut_val *val, const char *ptr, yyjson_mut_val *new_val, yyjson_mut_doc *doc)
Definition: yyjson.h:7398
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_doc_ptr_removen(yyjson_mut_doc *doc, const char *ptr, size_t len)
Definition: yyjson.h:7525
-
yyjson_api_inline bool yyjson_mut_doc_ptr_addn(yyjson_mut_doc *doc, const char *ptr, size_t len, yyjson_mut_val *new_val)
Definition: yyjson.h:7240
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_ptr_removex(yyjson_mut_val *val, const char *ptr, size_t len, yyjson_ptr_ctx *ctx, yyjson_ptr_err *err)
Definition: yyjson.h:7570
-
yyjson_api_inline bool yyjson_mut_doc_ptr_set(yyjson_mut_doc *doc, const char *ptr, yyjson_mut_val *new_val)
Definition: yyjson.h:7335
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_doc_ptr_replacen(yyjson_mut_doc *doc, const char *ptr, size_t len, yyjson_mut_val *new_val)
Definition: yyjson.h:7448
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_ptr_remove(yyjson_mut_val *val, const char *ptr)
Definition: yyjson.h:7558
-
yyjson_api_inline bool yyjson_mut_ptr_addn(yyjson_mut_val *val, const char *ptr, size_t len, yyjson_mut_val *new_val, yyjson_mut_doc *doc)
Definition: yyjson.h:7302
-
yyjson_api_inline bool yyjson_mut_ptr_add(yyjson_mut_val *val, const char *ptr, yyjson_mut_val *new_val, yyjson_mut_doc *doc)
Definition: yyjson.h:7294
-
yyjson_api_inline bool yyjson_mut_ptr_setn(yyjson_mut_val *val, const char *ptr, size_t len, yyjson_mut_val *new_val, yyjson_mut_doc *doc)
Definition: yyjson.h:7406
-
yyjson_api_inline bool yyjson_mut_doc_ptr_addx(yyjson_mut_doc *doc, const char *ptr, size_t len, yyjson_mut_val *new_val, bool create_parent, yyjson_ptr_ctx *ctx, yyjson_ptr_err *err)
Definition: yyjson.h:7247
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_ptr_replace(yyjson_mut_val *val, const char *ptr, yyjson_mut_val *new_val)
Definition: yyjson.h:7486
-
yyjson_api_inline bool yyjson_mut_doc_ptr_add(yyjson_mut_doc *doc, const char *ptr, yyjson_mut_val *new_val)
Definition: yyjson.h:7233
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_doc_ptr_replacex(yyjson_mut_doc *doc, const char *ptr, size_t len, yyjson_mut_val *new_val, yyjson_ptr_ctx *ctx, yyjson_ptr_err *err)
Definition: yyjson.h:7453
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_ptr_replacen(yyjson_mut_val *val, const char *ptr, size_t len, yyjson_mut_val *new_val)
Definition: yyjson.h:7492
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_doc_ptr_remove(yyjson_mut_doc *doc, const char *ptr)
Definition: yyjson.h:7527
+
yyjson_api_inline bool yyjson_mut_ptr_setx(yyjson_mut_val *val, const char *ptr, size_t len, yyjson_mut_val *new_val, yyjson_mut_doc *doc, bool create_parent, yyjson_ptr_ctx *ctx, yyjson_ptr_err *err)
Definition: yyjson.h:7421
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_doc_ptr_replace(yyjson_mut_doc *doc, const char *ptr, yyjson_mut_val *new_val)
Definition: yyjson.h:7450
+
yyjson_api_inline bool yyjson_mut_doc_ptr_setn(yyjson_mut_doc *doc, const char *ptr, size_t len, yyjson_mut_val *new_val)
Definition: yyjson.h:7350
+
yyjson_api_inline bool yyjson_mut_ptr_addx(yyjson_mut_val *val, const char *ptr, size_t len, yyjson_mut_val *new_val, yyjson_mut_doc *doc, bool create_parent, yyjson_ptr_ctx *ctx, yyjson_ptr_err *err)
Definition: yyjson.h:7317
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_doc_ptr_removex(yyjson_mut_doc *doc, const char *ptr, size_t len, yyjson_ptr_ctx *ctx, yyjson_ptr_err *err)
Definition: yyjson.h:7538
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_ptr_removen(yyjson_mut_val *val, const char *ptr, size_t len)
Definition: yyjson.h:7572
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_ptr_replacex(yyjson_mut_val *val, const char *ptr, size_t len, yyjson_mut_val *new_val, yyjson_ptr_ctx *ctx, yyjson_ptr_err *err)
Definition: yyjson.h:7505
+
yyjson_api_inline bool yyjson_mut_doc_ptr_setx(yyjson_mut_doc *doc, const char *ptr, size_t len, yyjson_mut_val *new_val, bool create_parent, yyjson_ptr_ctx *ctx, yyjson_ptr_err *err)
Definition: yyjson.h:7356
+
yyjson_api_inline bool yyjson_mut_ptr_set(yyjson_mut_val *val, const char *ptr, yyjson_mut_val *new_val, yyjson_mut_doc *doc)
Definition: yyjson.h:7406
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_doc_ptr_removen(yyjson_mut_doc *doc, const char *ptr, size_t len)
Definition: yyjson.h:7533
+
yyjson_api_inline bool yyjson_mut_doc_ptr_addn(yyjson_mut_doc *doc, const char *ptr, size_t len, yyjson_mut_val *new_val)
Definition: yyjson.h:7248
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_ptr_removex(yyjson_mut_val *val, const char *ptr, size_t len, yyjson_ptr_ctx *ctx, yyjson_ptr_err *err)
Definition: yyjson.h:7578
+
yyjson_api_inline bool yyjson_mut_doc_ptr_set(yyjson_mut_doc *doc, const char *ptr, yyjson_mut_val *new_val)
Definition: yyjson.h:7343
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_doc_ptr_replacen(yyjson_mut_doc *doc, const char *ptr, size_t len, yyjson_mut_val *new_val)
Definition: yyjson.h:7456
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_ptr_remove(yyjson_mut_val *val, const char *ptr)
Definition: yyjson.h:7566
+
yyjson_api_inline bool yyjson_mut_ptr_addn(yyjson_mut_val *val, const char *ptr, size_t len, yyjson_mut_val *new_val, yyjson_mut_doc *doc)
Definition: yyjson.h:7310
+
yyjson_api_inline bool yyjson_mut_ptr_add(yyjson_mut_val *val, const char *ptr, yyjson_mut_val *new_val, yyjson_mut_doc *doc)
Definition: yyjson.h:7302
+
yyjson_api_inline bool yyjson_mut_ptr_setn(yyjson_mut_val *val, const char *ptr, size_t len, yyjson_mut_val *new_val, yyjson_mut_doc *doc)
Definition: yyjson.h:7414
+
yyjson_api_inline bool yyjson_mut_doc_ptr_addx(yyjson_mut_doc *doc, const char *ptr, size_t len, yyjson_mut_val *new_val, bool create_parent, yyjson_ptr_ctx *ctx, yyjson_ptr_err *err)
Definition: yyjson.h:7255
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_ptr_replace(yyjson_mut_val *val, const char *ptr, yyjson_mut_val *new_val)
Definition: yyjson.h:7494
+
yyjson_api_inline bool yyjson_mut_doc_ptr_add(yyjson_mut_doc *doc, const char *ptr, yyjson_mut_val *new_val)
Definition: yyjson.h:7241
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_doc_ptr_replacex(yyjson_mut_doc *doc, const char *ptr, size_t len, yyjson_mut_val *new_val, yyjson_ptr_ctx *ctx, yyjson_ptr_err *err)
Definition: yyjson.h:7461
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_ptr_replacen(yyjson_mut_val *val, const char *ptr, size_t len, yyjson_mut_val *new_val)
Definition: yyjson.h:7500

For example:

yyjson_mut_doc *doc = ...;
// doc: {"a":0,"b":[1,2,3]}
@@ -1368,8 +1370,8 @@

yyjson_mut_val *val = yyjson_mut_doc_ptr_getx(doc, "/b/0", 4, &ctx, &err);
// now: {"a":0,"b":[2,3]}
-
yyjson_api_inline bool yyjson_mut_is_null(yyjson_mut_val *val)
Definition: yyjson.h:5388
-
yyjson_api_inline bool yyjson_ptr_ctx_remove(yyjson_ptr_ctx *ctx)
Definition: yyjson.h:7679
+
yyjson_api_inline bool yyjson_mut_is_null(yyjson_mut_val *val)
Definition: yyjson.h:5393
+
yyjson_api_inline bool yyjson_ptr_ctx_remove(yyjson_ptr_ctx *ctx)
Definition: yyjson.h:7687

JSON Patch

The library supports JSON Patch (RFC 6902). Specification and example: https://tools.ietf.org/html/rfc6902

// Creates and returns a patched JSON value.
@@ -1385,7 +1387,7 @@

yyjson_api yyjson_mut_val * yyjson_patch(yyjson_mut_doc *doc, yyjson_val *orig, yyjson_val *patch, yyjson_patch_err *err)
yyjson_api yyjson_mut_val * yyjson_mut_patch(yyjson_mut_doc *doc, yyjson_mut_val *orig, yyjson_mut_val *patch, yyjson_patch_err *err)
-
Definition: yyjson.h:4409
+
Definition: yyjson.h:4413

JSON Merge Patch

The library supports JSON Merge Patch (RFC 7386). Specification and example: https://tools.ietf.org/html/rfc7386

// Creates and returns a merge-patched JSON value.
diff --git a/doc/doxygen/html/md_doc__build_and_test.html b/doc/doxygen/html/md_doc__build_and_test.html index 6771a70..125241f 100644 --- a/doc/doxygen/html/md_doc__build_and_test.html +++ b/doc/doxygen/html/md_doc__build_and_test.html @@ -35,7 +35,7 @@ -
yyjson 0.8.0 +
yyjson 0.9.0
A high performance C JSON library.
@@ -256,16 +256,16 @@

-
yyjson_api_inline char * yyjson_val_write(const yyjson_val *val, yyjson_write_flag flg, size_t *len)
Definition: yyjson.h:1444
+
yyjson_api_inline char * yyjson_val_write(const yyjson_val *val, yyjson_write_flag flg, size_t *len)
Definition: yyjson.h:1448
yyjson_api bool yyjson_write_file(const char *path, const yyjson_doc *doc, yyjson_write_flag flg, const yyjson_alc *alc, yyjson_write_err *err)
yyjson_api char * yyjson_write_opts(const yyjson_doc *doc, yyjson_write_flag flg, const yyjson_alc *alc, size_t *len, yyjson_write_err *err)
-
yyjson_api_inline char * yyjson_mut_val_write(const yyjson_mut_val *val, yyjson_write_flag flg, size_t *len)
Definition: yyjson.h:1546
+
yyjson_api_inline char * yyjson_mut_val_write(const yyjson_mut_val *val, yyjson_write_flag flg, size_t *len)
Definition: yyjson.h:1550
yyjson_api bool yyjson_val_write_file(const char *path, const yyjson_val *val, yyjson_write_flag flg, const yyjson_alc *alc, yyjson_write_err *err)
yyjson_api char * yyjson_val_write_opts(const yyjson_val *val, yyjson_write_flag flg, const yyjson_alc *alc, size_t *len, yyjson_write_err *err)
yyjson_api char * yyjson_mut_write_opts(const yyjson_mut_doc *doc, yyjson_write_flag flg, const yyjson_alc *alc, size_t *len, yyjson_write_err *err)
-
yyjson_api_inline char * yyjson_mut_write(const yyjson_mut_doc *doc, yyjson_write_flag flg, size_t *len)
Definition: yyjson.h:1339
+
yyjson_api_inline char * yyjson_mut_write(const yyjson_mut_doc *doc, yyjson_write_flag flg, size_t *len)
Definition: yyjson.h:1343
yyjson_api char * yyjson_mut_val_write_opts(const yyjson_mut_val *val, yyjson_write_flag flg, const yyjson_alc *alc, size_t *len, yyjson_write_err *err)
-
yyjson_api_inline char * yyjson_write(const yyjson_doc *doc, yyjson_write_flag flg, size_t *len)
Definition: yyjson.h:1235
+
yyjson_api_inline char * yyjson_write(const yyjson_doc *doc, yyjson_write_flag flg, size_t *len)
Definition: yyjson.h:1239
yyjson_api bool yyjson_mut_write_file(const char *path, const yyjson_mut_doc *doc, yyjson_write_flag flg, const yyjson_alc *alc, yyjson_write_err *err)
yyjson_api bool yyjson_mut_val_write_file(const char *path, const yyjson_mut_val *val, yyjson_write_flag flg, const yyjson_alc *alc, yyjson_write_err *err)

This will reduce the binary size by about 30%.
diff --git a/doc/doxygen/html/md_doc__data_structure.html b/doc/doxygen/html/md_doc__data_structure.html index 8721b2c..42bedf4 100644 --- a/doc/doxygen/html/md_doc__data_structure.html +++ b/doc/doxygen/html/md_doc__data_structure.html @@ -35,7 +35,7 @@ -

yyjson 0.8.0 +
yyjson 0.9.0
A high performance C JSON library.
@@ -125,9 +125,9 @@

size_t ofs;
} uni;
}
-
yyjson_val_uni uni
Definition: yyjson.h:4494
-
uint64_t tag
Definition: yyjson.h:4493
-
Definition: yyjson.h:4492
+
yyjson_val_uni uni
Definition: yyjson.h:4498
+
uint64_t tag
Definition: yyjson.h:4497
+
Definition: yyjson.h:4496

The type of the value is stored in the lower 8 bits of the tag.
The size of the value, such as string length, object size, or array size, is stored in the higher 56 bits of the tag.

@@ -163,10 +163,10 @@

} uni;
}
-
yyjson_mut_val * next
Definition: yyjson.h:5261
-
yyjson_val_uni uni
Definition: yyjson.h:5260
-
uint64_t tag
Definition: yyjson.h:5259
-
Definition: yyjson.h:5258
+
yyjson_mut_val * next
Definition: yyjson.h:5266
+
yyjson_val_uni uni
Definition: yyjson.h:5265
+
uint64_t tag
Definition: yyjson.h:5264
+
Definition: yyjson.h:5263

The tag and uni fields are the same as the immutable value, and the next field is used to build a linked list.

diff --git a/doc/doxygen/html/navtreedata.js b/doc/doxygen/html/navtreedata.js index e18ef94..2c2afeb 100644 --- a/doc/doxygen/html/navtreedata.js +++ b/doc/doxygen/html/navtreedata.js @@ -117,15 +117,16 @@ var NAVTREE = [ "Memory Management", "md_doc__data_structure.html#autotoc_md88", null ] ] ], [ "Changelog", "md__c_h_a_n_g_e_l_o_g.html", [ - [ "0.8.0 (2023-09-13)", "md__c_h_a_n_g_e_l_o_g.html#autotoc_md90", null ], - [ "0.7.0 (2023-05-25)", "md__c_h_a_n_g_e_l_o_g.html#autotoc_md94", null ], - [ "0.6.0 (2022-12-12)", "md__c_h_a_n_g_e_l_o_g.html#autotoc_md98", null ], - [ "0.5.1 (2022-06-17)", "md__c_h_a_n_g_e_l_o_g.html#autotoc_md101", null ], - [ "0.5.0 (2022-05-25)", "md__c_h_a_n_g_e_l_o_g.html#autotoc_md103", null ], - [ "0.4.0 (2021-12-12)", "md__c_h_a_n_g_e_l_o_g.html#autotoc_md107", null ], - [ "0.3.0 (2021-05-25)", "md__c_h_a_n_g_e_l_o_g.html#autotoc_md111", null ], - [ "0.2.0 (2020-12-12)", "md__c_h_a_n_g_e_l_o_g.html#autotoc_md115", null ], - [ "0.1.0 (2020-10-26)", "md__c_h_a_n_g_e_l_o_g.html#autotoc_md120", null ] + [ "0.9.0 (2024-04-08)", "md__c_h_a_n_g_e_l_o_g.html#autotoc_md90", null ], + [ "0.8.0 (2023-09-13)", "md__c_h_a_n_g_e_l_o_g.html#autotoc_md94", null ], + [ "0.7.0 (2023-05-25)", "md__c_h_a_n_g_e_l_o_g.html#autotoc_md98", null ], + [ "0.6.0 (2022-12-12)", "md__c_h_a_n_g_e_l_o_g.html#autotoc_md102", null ], + [ "0.5.1 (2022-06-17)", "md__c_h_a_n_g_e_l_o_g.html#autotoc_md105", null ], + [ "0.5.0 (2022-05-25)", "md__c_h_a_n_g_e_l_o_g.html#autotoc_md107", null ], + [ "0.4.0 (2021-12-12)", "md__c_h_a_n_g_e_l_o_g.html#autotoc_md111", null ], + [ "0.3.0 (2021-05-25)", "md__c_h_a_n_g_e_l_o_g.html#autotoc_md115", null ], + [ "0.2.0 (2020-12-12)", "md__c_h_a_n_g_e_l_o_g.html#autotoc_md119", null ], + [ "0.1.0 (2020-10-26)", "md__c_h_a_n_g_e_l_o_g.html#autotoc_md124", null ] ] ], [ "Deprecated List", "deprecated.html", null ], [ "Files", "files.html", [ @@ -152,8 +153,8 @@ var NAVTREE = var NAVTREEINDEX = [ "annotated.html", -"yyjson_8h.html#a4530f9fc02f8604cef3de273feb4ab6a", -"yyjson_8h.html#ad0f58bd6ac0289fd55d09b02fa3d4743" +"yyjson_8h.html#a4408e0c5928db936b89d49ccf255100b", +"yyjson_8h.html#acf234d21f0cb4b7fc89381ef25e9f0a8" ]; var SYNCONMSG = 'click to disable panel synchronisation'; diff --git a/doc/doxygen/html/navtreeindex0.js b/doc/doxygen/html/navtreeindex0.js index e2c2941..2a3d2f6 100644 --- a/doc/doxygen/html/navtreeindex0.js +++ b/doc/doxygen/html/navtreeindex0.js @@ -27,12 +27,13 @@ var NAVTREEINDEX0 = "index.html#autotoc_md3":[0,2], "index.html#autotoc_md7":[0,3], "md__c_h_a_n_g_e_l_o_g.html":[4], -"md__c_h_a_n_g_e_l_o_g.html#autotoc_md101":[4,3], -"md__c_h_a_n_g_e_l_o_g.html#autotoc_md103":[4,4], +"md__c_h_a_n_g_e_l_o_g.html#autotoc_md102":[4,3], +"md__c_h_a_n_g_e_l_o_g.html#autotoc_md105":[4,4], "md__c_h_a_n_g_e_l_o_g.html#autotoc_md107":[4,5], "md__c_h_a_n_g_e_l_o_g.html#autotoc_md111":[4,6], "md__c_h_a_n_g_e_l_o_g.html#autotoc_md115":[4,7], -"md__c_h_a_n_g_e_l_o_g.html#autotoc_md120":[4,8], +"md__c_h_a_n_g_e_l_o_g.html#autotoc_md119":[4,8], +"md__c_h_a_n_g_e_l_o_g.html#autotoc_md124":[4,9], "md__c_h_a_n_g_e_l_o_g.html#autotoc_md90":[4,0], "md__c_h_a_n_g_e_l_o_g.html#autotoc_md94":[4,1], "md__c_h_a_n_g_e_l_o_g.html#autotoc_md98":[4,2], @@ -178,7 +179,7 @@ var NAVTREEINDEX0 = "yyjson_8h.html#a1e8a4dea2e9e9248acde14c664ab702b":[6,0,0,0,343], "yyjson_8h.html#a1efeaba2c4446788c9b30d20e1b82f73":[6,0,0,0,49], "yyjson_8h.html#a1f3b09c4f279287f8af93b3754a41e85":[6,0,0,0,345], -"yyjson_8h.html#a20d8f66fbe535a20596001dc2022f0b4":[6,0,0,0,444], +"yyjson_8h.html#a20d8f66fbe535a20596001dc2022f0b4":[6,0,0,0,445], "yyjson_8h.html#a20fa69856e99295473e1b3e111adc3b1":[6,0,0,0,165], "yyjson_8h.html#a210aa96478b0b005b1611fe2f0ecbaa2":[6,0,0,0,267], "yyjson_8h.html#a214c115652630e5acaa9fa062844e0c9":[6,0,0,0,162], @@ -248,6 +249,5 @@ var NAVTREEINDEX0 = "yyjson_8h.html#a41a31c0ddcce2b75cacb5fd2375d1ca7":[6,0,0,0,400], "yyjson_8h.html#a41cb8e304e08d7455f43c753bfa19b82":[6,0,0,0,431], "yyjson_8h.html#a41f9c6e4641f813a7a94f12ea79b34ce":[6,0,0,0,305], -"yyjson_8h.html#a43ccc01254525cef16699e72079e3e49":[6,0,0,0,390], -"yyjson_8h.html#a4408e0c5928db936b89d49ccf255100b":[6,0,0,0,440] +"yyjson_8h.html#a43ccc01254525cef16699e72079e3e49":[6,0,0,0,390] }; diff --git a/doc/doxygen/html/navtreeindex1.js b/doc/doxygen/html/navtreeindex1.js index dd7c8f9..16fc7ca 100644 --- a/doc/doxygen/html/navtreeindex1.js +++ b/doc/doxygen/html/navtreeindex1.js @@ -1,5 +1,6 @@ var NAVTREEINDEX1 = { +"yyjson_8h.html#a4408e0c5928db936b89d49ccf255100b":[6,0,0,0,440], "yyjson_8h.html#a4530f9fc02f8604cef3de273feb4ab6a":[6,0,0,0,263], "yyjson_8h.html#a45a5da162ba8a920163c74b71f48ead8":[6,0,0,0,32], "yyjson_8h.html#a4781760a87346473a82f26fdd897fa52":[6,0,0,0,33], @@ -111,7 +112,7 @@ var NAVTREEINDEX1 = "yyjson_8h.html#a7a45a4b5a1340bb3c2907b7faf3981be":[6,0,0,0,347], "yyjson_8h.html#a7a5f504993031f912d06777b8a7b5aff":[6,0,0,0,194], "yyjson_8h.html#a7af42d62aa1583986c687c5cd10b010e":[6,0,0,0,342], -"yyjson_8h.html#a7b13411e137d8085b68b2e0fc9d6736b":[6,0,0,0,443], +"yyjson_8h.html#a7b13411e137d8085b68b2e0fc9d6736b":[6,0,0,0,444], "yyjson_8h.html#a7b766ff66469615aab5bed9f760aab07":[6,0,0,0,71], "yyjson_8h.html#a7bb8c32c190a8e4ce4f5e9e95623f304":[6,0,0,0,239], "yyjson_8h.html#a7d15bc48e9734dab6620e35ec30cc348":[6,0,0,0,46], @@ -198,6 +199,7 @@ var NAVTREEINDEX1 = "yyjson_8h.html#aaed218041aa262337e179d487f4c770c":[6,0,0,0,112], "yyjson_8h.html#aaf5c505b42eeb64e7a0ac17e3d7d3847":[6,0,0,0,6,2], "yyjson_8h.html#ab0a5c5a568b7f2c0a6301149f0f6aa84":[6,0,0,0,217], +"yyjson_8h.html#ab0cfae40d7ae6489d73c6cf5db9c09e1":[6,0,0,0,441], "yyjson_8h.html#ab1a7e03f48bb31760030fbdab7d6597b":[6,0,0,0,12,0], "yyjson_8h.html#ab2237deb1190a0333a88d571a8adcb0c":[6,0,0,0,188], "yyjson_8h.html#ab2c44c43c9e8ff194799fd59ae688ee2":[6,0,0,0,218], @@ -247,7 +249,5 @@ var NAVTREEINDEX1 = "yyjson_8h.html#acbfde7c1173b4258f83029c6dacf47c3":[6,0,0,0,280], "yyjson_8h.html#acd2884309c99b42f916fffd50c018c59":[6,0,0,0,146], "yyjson_8h.html#acd434c1a97d275f97f743e47e228831a":[6,0,0,0,326], -"yyjson_8h.html#acf1b73925eff2306f4e23837cd874c8d":[6,0,0,0,29], -"yyjson_8h.html#acf234d21f0cb4b7fc89381ef25e9f0a8":[6,0,0,0,371], -"yyjson_8h.html#acfc8545d9b1af8dd8f1488e34fbac351":[6,0,0,0,244] +"yyjson_8h.html#acf1b73925eff2306f4e23837cd874c8d":[6,0,0,0,29] }; diff --git a/doc/doxygen/html/navtreeindex2.js b/doc/doxygen/html/navtreeindex2.js index 0cb9f12..a2a91a9 100644 --- a/doc/doxygen/html/navtreeindex2.js +++ b/doc/doxygen/html/navtreeindex2.js @@ -1,5 +1,7 @@ var NAVTREEINDEX2 = { +"yyjson_8h.html#acf234d21f0cb4b7fc89381ef25e9f0a8":[6,0,0,0,371], +"yyjson_8h.html#acfc8545d9b1af8dd8f1488e34fbac351":[6,0,0,0,244], "yyjson_8h.html#ad0f58bd6ac0289fd55d09b02fa3d4743":[6,0,0,0,377], "yyjson_8h.html#ad18730f04c429faa79be473de57efd5e":[6,0,0,0,236], "yyjson_8h.html#ad20aad460c6d7c62f7c371ca5be54667":[6,0,0,0,144], @@ -32,7 +34,7 @@ var NAVTREEINDEX2 = "yyjson_8h.html#addf8b34eb1d89a54df0482acbd29872c":[6,0,0,0,4,3], "yyjson_8h.html#adf8b2d3c8b57e85d58108d58c68b0db5":[6,0,0,0,336], "yyjson_8h.html#ae0898f45c9fca1d7d6bdd35b3488a10f":[6,0,0,0,161], -"yyjson_8h.html#ae152a6e8e8c6e4efd798fa6eca9d311f":[6,0,0,0,441], +"yyjson_8h.html#ae152a6e8e8c6e4efd798fa6eca9d311f":[6,0,0,0,442], "yyjson_8h.html#ae19102b96509817f1188f732be19642b":[6,0,0,0,78], "yyjson_8h.html#ae1a372cfbbc8a536decaf1db5223804d":[6,0,0,0,199], "yyjson_8h.html#ae2709fd5ec704ef7a569d62195e4652d":[6,0,0,0,430], @@ -51,7 +53,7 @@ var NAVTREEINDEX2 = "yyjson_8h.html#ae8f6fbea7b0eee0545bcf8d272ce7f33":[6,0,0,0,30], "yyjson_8h.html#aea65c64007cfa236faa17e1ac87c4e5e":[6,0,0,0,286], "yyjson_8h.html#aeab3c2a1d86225e5b181fb1bba7587d4":[6,0,0,0,366], -"yyjson_8h.html#aebdaa55a1673e99d2dcea01a15c633be":[6,0,0,0,442], +"yyjson_8h.html#aebdaa55a1673e99d2dcea01a15c633be":[6,0,0,0,443], "yyjson_8h.html#aec0e874c4847338f3b61bf46257cb557":[6,0,0,0,140], "yyjson_8h.html#aec30d870399447d1b611c400dff5a55c":[6,0,0,0,421], "yyjson_8h.html#aec3a6e6812f3ca8fd58c858275443fe0":[6,0,0,0,223], diff --git a/doc/doxygen/html/pages.html b/doc/doxygen/html/pages.html index 63e01f3..1137e0d 100644 --- a/doc/doxygen/html/pages.html +++ b/doc/doxygen/html/pages.html @@ -35,7 +35,7 @@ -
yyjson 0.8.0 +
yyjson 0.9.0
A high performance C JSON library.
diff --git a/doc/doxygen/html/search/all_10.js b/doc/doxygen/html/search/all_10.js index 5f37e53..eb8d15f 100644 --- a/doc/doxygen/html/search/all_10.js +++ b/doc/doxygen/html/search/all_10.js @@ -430,9 +430,10 @@ var searchData= ['yyjson_5fwrite_5fflag_427',['yyjson_write_flag',['../yyjson_8h.html#afb7989387fc481f678e13325c18e6338',1,'yyjson.h']]], ['yyjson_5fwrite_5ffp_428',['yyjson_write_fp',['../yyjson_8h.html#a29eea00c04954094701bd90235a7073e',1,'yyjson.h']]], ['yyjson_5fwrite_5finf_5fand_5fnan_5fas_5fnull_429',['YYJSON_WRITE_INF_AND_NAN_AS_NULL',['../yyjson_8h.html#a4408e0c5928db936b89d49ccf255100b',1,'yyjson.h']]], - ['yyjson_5fwrite_5fnoflag_430',['YYJSON_WRITE_NOFLAG',['../yyjson_8h.html#ae152a6e8e8c6e4efd798fa6eca9d311f',1,'yyjson.h']]], - ['yyjson_5fwrite_5fopts_431',['yyjson_write_opts',['../yyjson_8h.html#a43ccc01254525cef16699e72079e3e49',1,'yyjson.h']]], - ['yyjson_5fwrite_5fpretty_432',['YYJSON_WRITE_PRETTY',['../yyjson_8h.html#aebdaa55a1673e99d2dcea01a15c633be',1,'yyjson.h']]], - ['yyjson_5fwrite_5fpretty_5ftwo_5fspaces_433',['YYJSON_WRITE_PRETTY_TWO_SPACES',['../yyjson_8h.html#a7b13411e137d8085b68b2e0fc9d6736b',1,'yyjson.h']]], - ['yyjson_5fwrite_5fsuccess_434',['YYJSON_WRITE_SUCCESS',['../yyjson_8h.html#a20d8f66fbe535a20596001dc2022f0b4',1,'yyjson.h']]] + ['yyjson_5fwrite_5fnewline_5fat_5fend_430',['YYJSON_WRITE_NEWLINE_AT_END',['../yyjson_8h.html#ab0cfae40d7ae6489d73c6cf5db9c09e1',1,'yyjson.h']]], + ['yyjson_5fwrite_5fnoflag_431',['YYJSON_WRITE_NOFLAG',['../yyjson_8h.html#ae152a6e8e8c6e4efd798fa6eca9d311f',1,'yyjson.h']]], + ['yyjson_5fwrite_5fopts_432',['yyjson_write_opts',['../yyjson_8h.html#a43ccc01254525cef16699e72079e3e49',1,'yyjson.h']]], + ['yyjson_5fwrite_5fpretty_433',['YYJSON_WRITE_PRETTY',['../yyjson_8h.html#aebdaa55a1673e99d2dcea01a15c633be',1,'yyjson.h']]], + ['yyjson_5fwrite_5fpretty_5ftwo_5fspaces_434',['YYJSON_WRITE_PRETTY_TWO_SPACES',['../yyjson_8h.html#a7b13411e137d8085b68b2e0fc9d6736b',1,'yyjson.h']]], + ['yyjson_5fwrite_5fsuccess_435',['YYJSON_WRITE_SUCCESS',['../yyjson_8h.html#a20d8f66fbe535a20596001dc2022f0b4',1,'yyjson.h']]] ]; diff --git a/doc/doxygen/html/search/variables_e.js b/doc/doxygen/html/search/variables_e.js index bd48fa3..1ba8e9b 100644 --- a/doc/doxygen/html/search/variables_e.js +++ b/doc/doxygen/html/search/variables_e.js @@ -50,8 +50,9 @@ var searchData= ['yyjson_5fwrite_5fescape_5fslashes_47',['YYJSON_WRITE_ESCAPE_SLASHES',['../yyjson_8h.html#a0eeb35b40e688fce9dd61ed400984042',1,'yyjson.h']]], ['yyjson_5fwrite_5fescape_5funicode_48',['YYJSON_WRITE_ESCAPE_UNICODE',['../yyjson_8h.html#ac234e82f7a1203e656bcbb0af2ce8c01',1,'yyjson.h']]], ['yyjson_5fwrite_5finf_5fand_5fnan_5fas_5fnull_49',['YYJSON_WRITE_INF_AND_NAN_AS_NULL',['../yyjson_8h.html#a4408e0c5928db936b89d49ccf255100b',1,'yyjson.h']]], - ['yyjson_5fwrite_5fnoflag_50',['YYJSON_WRITE_NOFLAG',['../yyjson_8h.html#ae152a6e8e8c6e4efd798fa6eca9d311f',1,'yyjson.h']]], - ['yyjson_5fwrite_5fpretty_51',['YYJSON_WRITE_PRETTY',['../yyjson_8h.html#aebdaa55a1673e99d2dcea01a15c633be',1,'yyjson.h']]], - ['yyjson_5fwrite_5fpretty_5ftwo_5fspaces_52',['YYJSON_WRITE_PRETTY_TWO_SPACES',['../yyjson_8h.html#a7b13411e137d8085b68b2e0fc9d6736b',1,'yyjson.h']]], - ['yyjson_5fwrite_5fsuccess_53',['YYJSON_WRITE_SUCCESS',['../yyjson_8h.html#a20d8f66fbe535a20596001dc2022f0b4',1,'yyjson.h']]] + ['yyjson_5fwrite_5fnewline_5fat_5fend_50',['YYJSON_WRITE_NEWLINE_AT_END',['../yyjson_8h.html#ab0cfae40d7ae6489d73c6cf5db9c09e1',1,'yyjson.h']]], + ['yyjson_5fwrite_5fnoflag_51',['YYJSON_WRITE_NOFLAG',['../yyjson_8h.html#ae152a6e8e8c6e4efd798fa6eca9d311f',1,'yyjson.h']]], + ['yyjson_5fwrite_5fpretty_52',['YYJSON_WRITE_PRETTY',['../yyjson_8h.html#aebdaa55a1673e99d2dcea01a15c633be',1,'yyjson.h']]], + ['yyjson_5fwrite_5fpretty_5ftwo_5fspaces_53',['YYJSON_WRITE_PRETTY_TWO_SPACES',['../yyjson_8h.html#a7b13411e137d8085b68b2e0fc9d6736b',1,'yyjson.h']]], + ['yyjson_5fwrite_5fsuccess_54',['YYJSON_WRITE_SUCCESS',['../yyjson_8h.html#a20d8f66fbe535a20596001dc2022f0b4',1,'yyjson.h']]] ]; diff --git a/doc/doxygen/html/structyyjson__alc.html b/doc/doxygen/html/structyyjson__alc.html index 88faf1f..806745d 100644 --- a/doc/doxygen/html/structyyjson__alc.html +++ b/doc/doxygen/html/structyyjson__alc.html @@ -35,7 +35,7 @@ -
yyjson 0.8.0 +
yyjson 0.9.0
A high performance C JSON library.
diff --git a/doc/doxygen/html/yyjson_8h.html b/doc/doxygen/html/yyjson_8h.html index 988f4d6..02b57bc 100644 --- a/doc/doxygen/html/yyjson_8h.html +++ b/doc/doxygen/html/yyjson_8h.html @@ -35,7 +35,7 @@ -
yyjson 0.8.0 +
yyjson 0.9.0
A high performance C JSON library.
@@ -194,13 +194,13 @@   #define YYJSON_VERSION_MAJOR   0   -#define YYJSON_VERSION_MINOR   8 +#define YYJSON_VERSION_MINOR   9   #define YYJSON_VERSION_PATCH   0   -#define YYJSON_VERSION_HEX   0x000800 +#define YYJSON_VERSION_HEX   0x000900   -#define YYJSON_VERSION_STRING   "0.8.0" +#define YYJSON_VERSION_STRING   "0.9.0"   #define YYJSON_TYPE_NONE   ((uint8_t)0) /* _____000 */   @@ -905,7 +905,7 @@ - + @@ -951,7 +951,7 @@ - + @@ -967,6 +967,8 @@ + + @@ -1106,10 +1108,10 @@

your_func(val);
}
-
yyjson_api_inline yyjson_arr_iter yyjson_arr_iter_with(yyjson_val *arr)
Definition: yyjson.h:5120
-
yyjson_api_inline yyjson_val * yyjson_arr_iter_next(yyjson_arr_iter *iter)
Definition: yyjson.h:5130
-
Definition: yyjson.h:1806
-
Definition: yyjson.h:4492
+
yyjson_api_inline yyjson_arr_iter yyjson_arr_iter_with(yyjson_val *arr)
Definition: yyjson.h:5125
+
yyjson_api_inline yyjson_val * yyjson_arr_iter_next(yyjson_arr_iter *iter)
Definition: yyjson.h:5135
+
Definition: yyjson.h:1810
+
Definition: yyjson.h:4496

Variables

static const yyjson_read_flag YYJSON_READ_NOFLAG = 0 << 0
static const yyjson_read_flag YYJSON_READ_NOFLAG = 0
 
static const yyjson_read_flag YYJSON_READ_INSITU = 1 << 0
 
 
static const yyjson_read_code YYJSON_READ_ERROR_FILE_READ = 13
 
static const yyjson_write_flag YYJSON_WRITE_NOFLAG = 0 << 0
static const yyjson_write_flag YYJSON_WRITE_NOFLAG = 0
 
static const yyjson_write_flag YYJSON_WRITE_PRETTY = 1 << 0
 
 
static const yyjson_write_flag YYJSON_WRITE_PRETTY_TWO_SPACES = 1 << 6
 
static const yyjson_write_flag YYJSON_WRITE_NEWLINE_AT_END = 1 << 7
 
static const yyjson_write_code YYJSON_WRITE_SUCCESS = 0
 
static const yyjson_write_code YYJSON_WRITE_ERROR_INVALID_PARAMETER = 1
@@ -1156,18 +1158,18 @@

your_func(key, val);
}
-
yyjson_api_inline yyjson_val * yyjson_obj_iter_get_val(yyjson_val *key)
Definition: yyjson.h:5209
-
yyjson_api_inline yyjson_obj_iter yyjson_obj_iter_with(yyjson_val *obj)
Definition: yyjson.h:5189
-
yyjson_api_inline yyjson_val * yyjson_obj_iter_next(yyjson_obj_iter *iter)
Definition: yyjson.h:5199
-
yyjson_val * obj
Definition: yyjson.h:1934
-
Definition: yyjson.h:1930
+
yyjson_api_inline yyjson_val * yyjson_obj_iter_get_val(yyjson_val *key)
Definition: yyjson.h:5214
+
yyjson_api_inline yyjson_obj_iter yyjson_obj_iter_with(yyjson_val *obj)
Definition: yyjson.h:5194
+
yyjson_api_inline yyjson_val * yyjson_obj_iter_next(yyjson_obj_iter *iter)
Definition: yyjson.h:5204
+
yyjson_val * obj
Definition: yyjson.h:1938
+
Definition: yyjson.h:1934

If the ordering of the keys is known at compile-time, you can use this method to speed up value lookups:

// {"k1":1, "k2": 3, "k3": 3}
yyjson_val *key, *val;
yyjson_val *v1 = yyjson_obj_iter_get(&iter, "k1");
yyjson_val *v3 = yyjson_obj_iter_get(&iter, "k3");
-
yyjson_api_inline yyjson_val * yyjson_obj_iter_get(yyjson_obj_iter *iter, const char *key)
Definition: yyjson.h:5213
+
yyjson_api_inline yyjson_val * yyjson_obj_iter_get(yyjson_obj_iter *iter, const char *key)
Definition: yyjson.h:5218
See also
yyjson_obj_iter_get() and yyjson_obj_iter_getn()

Data Fields
@@ -1224,12 +1226,12 @@

yyjson_mut_arr_iter_remove(&iter);
}
}
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_iter_remove(yyjson_mut_arr_iter *iter)
Definition: yyjson.h:5865
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_iter_next(yyjson_mut_arr_iter *iter)
Definition: yyjson.h:5853
-
yyjson_api_inline yyjson_mut_arr_iter yyjson_mut_arr_iter_with(yyjson_mut_val *arr)
Definition: yyjson.h:5842
-
yyjson_mut_val * arr
Definition: yyjson.h:2491
-
Definition: yyjson.h:2486
-
Definition: yyjson.h:5258
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_iter_remove(yyjson_mut_arr_iter *iter)
Definition: yyjson.h:5871
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_iter_next(yyjson_mut_arr_iter *iter)
Definition: yyjson.h:5859
+
yyjson_api_inline yyjson_mut_arr_iter yyjson_mut_arr_iter_with(yyjson_mut_val *arr)
Definition: yyjson.h:5848
+
yyjson_mut_val * arr
Definition: yyjson.h:2495
+
Definition: yyjson.h:2490
+
Definition: yyjson.h:5263

Data Fields
@@ -1294,19 +1296,19 @@

yyjson_mut_obj_iter_remove(&iter);
}
}
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_iter_next(yyjson_mut_obj_iter *iter)
Definition: yyjson.h:6488
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_iter_remove(yyjson_mut_obj_iter *iter)
Definition: yyjson.h:6505
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_iter_get_val(yyjson_mut_val *key)
Definition: yyjson.h:6500
-
yyjson_mut_val * obj
Definition: yyjson.h:3293
-
yyjson_api_inline yyjson_mut_obj_iter yyjson_mut_obj_iter_with(yyjson_mut_val *obj)
Definition: yyjson.h:6477
-
Definition: yyjson.h:3288
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_iter_next(yyjson_mut_obj_iter *iter)
Definition: yyjson.h:6495
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_iter_remove(yyjson_mut_obj_iter *iter)
Definition: yyjson.h:6512
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_iter_get_val(yyjson_mut_val *key)
Definition: yyjson.h:6507
+
yyjson_mut_val * obj
Definition: yyjson.h:3297
+
yyjson_api_inline yyjson_mut_obj_iter yyjson_mut_obj_iter_with(yyjson_mut_val *obj)
Definition: yyjson.h:6484
+
Definition: yyjson.h:3292

If the ordering of the keys is known at compile-time, you can use this method to speed up value lookups:

// {"k1":1, "k2": 3, "k3": 3}
yyjson_mut_val *key, *val;
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_iter_get(yyjson_mut_obj_iter *iter, const char *key)
Definition: yyjson.h:6522
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_iter_get(yyjson_mut_obj_iter *iter, const char *key)
Definition: yyjson.h:6529
See also
yyjson_mut_obj_iter_get() and yyjson_mut_obj_iter_getn()

Data Fields
@@ -1408,9 +1410,9 @@

&
}
// doc after: {"a":[0,1]}
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_doc_ptr_getx(yyjson_mut_doc *doc, const char *ptr, size_t len, yyjson_ptr_ctx *ctx, yyjson_ptr_err *err)
Definition: yyjson.h:7173
-
yyjson_api_inline bool yyjson_is_null(yyjson_val *val)
Definition: yyjson.h:4847
-
yyjson_api_inline bool yyjson_ptr_ctx_remove(yyjson_ptr_ctx *ctx)
Definition: yyjson.h:7679
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_doc_ptr_getx(yyjson_mut_doc *doc, const char *ptr, size_t len, yyjson_ptr_ctx *ctx, yyjson_ptr_err *err)
Definition: yyjson.h:7181
+
yyjson_api_inline bool yyjson_is_null(yyjson_val *val)
Definition: yyjson.h:4852
+
yyjson_api_inline bool yyjson_ptr_ctx_remove(yyjson_ptr_ctx *ctx)
Definition: yyjson.h:7687

Data Fields
@@ -14714,6 +14716,29 @@

Write inf and nan number as null literal. This flag will override YYJSON_WRITE_ALLOW_INF_AND_NAN flag.

+ + +
+

◆ YYJSON_WRITE_NEWLINE_AT_END

+ +
+
+

Data Fields
@@ -1839,15 +1841,15 @@

(idx) < (max); \
(idx)++, \
(val) = unsafe_yyjson_get_next(val))
-
yyjson_api_inline size_t yyjson_arr_size(yyjson_val *arr)
Definition: yyjson.h:5058
-
yyjson_api_inline yyjson_val * yyjson_arr_get_first(yyjson_val *arr)
Definition: yyjson.h:5077
+
yyjson_api_inline size_t yyjson_arr_size(yyjson_val *arr)
Definition: yyjson.h:5063
+
yyjson_api_inline yyjson_val * yyjson_arr_get_first(yyjson_val *arr)
Definition: yyjson.h:5082

Macro for iterating over an array. It works like iterator, but with a more intuitive API.

Example
size_t idx, max;
yyjson_arr_foreach(arr, idx, max, val) {
your_func(idx, val);
}
-
#define yyjson_arr_foreach(arr, idx, max, val)
Definition: yyjson.h:1862
+
#define yyjson_arr_foreach(arr, idx, max, val)
Definition: yyjson.h:1866
@@ -2099,8 +2101,8 @@

(idx) < (max); \
(idx)++, \
(val) = (val)->next)
-
yyjson_api_inline size_t yyjson_mut_arr_size(yyjson_mut_val *arr)
Definition: yyjson.h:5792
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_get_first(yyjson_mut_val *arr)
Definition: yyjson.h:5806
+
yyjson_api_inline size_t yyjson_mut_arr_size(yyjson_mut_val *arr)
Definition: yyjson.h:5798
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_get_first(yyjson_mut_val *arr)
Definition: yyjson.h:5812

Macro for iterating over an array. It works like iterator, but with a more intuitive API.

Warning
You should not modify the array while iterating over it.
Example
size_t idx, max;
@@ -2108,7 +2110,7 @@

yyjson_mut_arr_foreach(arr, idx, max, val) {

your_func(idx, val);
}
-
#define yyjson_mut_arr_foreach(arr, idx, max, val)
Definition: yyjson.h:2556
+
#define yyjson_mut_arr_foreach(arr, idx, max, val)
Definition: yyjson.h:2560
@@ -2164,7 +2166,7 @@

(idx)++, \
(key) = (val)->next, \
(val) = (key)->next)
-
yyjson_api_inline size_t yyjson_mut_obj_size(yyjson_mut_val *obj)
Definition: yyjson.h:6434
+
yyjson_api_inline size_t yyjson_mut_obj_size(yyjson_mut_val *obj)
Definition: yyjson.h:6441

Macro for iterating over an object. It works like iterator, but with a more intuitive API.

Warning
You should not modify the object while iterating over it.
Example
size_t idx, max;
@@ -2172,7 +2174,7 @@

yyjson_obj_foreach(obj, idx, max, key, val) {

your_func(key, val);
}
-
#define yyjson_obj_foreach(obj, idx, max, key, val)
Definition: yyjson.h:2033
+
#define yyjson_obj_foreach(obj, idx, max, key, val)
Definition: yyjson.h:2037
@@ -2243,7 +2245,7 @@

(idx)++, \
(key) = unsafe_yyjson_get_next(val), \
(val) = (key) + 1)
-
yyjson_api_inline size_t yyjson_obj_size(yyjson_val *obj)
Definition: yyjson.h:5147
+
yyjson_api_inline size_t yyjson_obj_size(yyjson_val *obj)
Definition: yyjson.h:5152

Macro for iterating over an object. It works like iterator, but with a more intuitive API.

Example
@@ -2961,7 +2963,7 @@

Definition: yyjson.h:618

yyjson_api bool yyjson_alc_pool_init(yyjson_alc *alc, void *buf, size_t size)
yyjson_api yyjson_doc * yyjson_read_opts(char *dat, size_t len, yyjson_read_flag flg, const yyjson_alc *alc, yyjson_read_err *err)
-
Definition: yyjson.h:4497
+
Definition: yyjson.h:4501
Warning
This Allocator is not thread-safe.
@@ -5471,7 +5473,7 @@

Returns
The new array. NULL if input is invalid or memory allocation failed.
Example
const bool vals[3] = { true, false, true };
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_bool(yyjson_mut_doc *doc, const bool *vals, size_t count)
Definition: yyjson.h:5920
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_bool(yyjson_mut_doc *doc, const bool *vals, size_t count)
Definition: yyjson.h:5926
@@ -5519,7 +5521,7 @@

Returns
The new array. NULL if input is invalid or memory allocation failed.
Example
const double vals[3] = { -1.0, 0.0, 1.0 };
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_double(yyjson_mut_doc *doc, const double *vals, size_t count)
Definition: yyjson.h:6014
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_double(yyjson_mut_doc *doc, const double *vals, size_t count)
Definition: yyjson.h:6021
@@ -5567,7 +5569,7 @@

Returns
The new array. NULL if input is invalid or memory allocation failed.
Example
const float vals[3] = { -1.0f, 0.0f, 1.0f };
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_float(yyjson_mut_doc *doc, const float *vals, size_t count)
Definition: yyjson.h:6006
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_float(yyjson_mut_doc *doc, const float *vals, size_t count)
Definition: yyjson.h:6013
@@ -5615,7 +5617,7 @@

Returns
The new array. NULL if input is invalid or memory allocation failed.
Example
const double vals[3] = { 0.1, 0.2, 0.3 };
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_real(yyjson_mut_doc *doc, const double *vals, size_t count)
Definition: yyjson.h:5937
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_real(yyjson_mut_doc *doc, const double *vals, size_t count)
Definition: yyjson.h:5944
@@ -5663,7 +5665,7 @@

Returns
The new array. NULL if input is invalid or memory allocation failed.
Example
const int64_t vals[3] = { -1, 0, 1 };
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_sint64(yyjson_mut_doc *doc, const int64_t *vals, size_t count)
Definition: yyjson.h:5966
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_sint64(yyjson_mut_doc *doc, const int64_t *vals, size_t count)
Definition: yyjson.h:5973
@@ -5711,7 +5713,7 @@

Returns
The new array. NULL if input is invalid or memory allocation failed.
Example
const int16_t vals[3] = { -1, 0, 1 };
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_sint16(yyjson_mut_doc *doc, const int16_t *vals, size_t count)
Definition: yyjson.h:5950
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_sint16(yyjson_mut_doc *doc, const int16_t *vals, size_t count)
Definition: yyjson.h:5957
@@ -5759,7 +5761,7 @@

Returns
The new array. NULL if input is invalid or memory allocation failed.
Example
const int32_t vals[3] = { -1, 0, 1 };
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_sint32(yyjson_mut_doc *doc, const int32_t *vals, size_t count)
Definition: yyjson.h:5958
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_sint32(yyjson_mut_doc *doc, const int32_t *vals, size_t count)
Definition: yyjson.h:5965
@@ -5854,7 +5856,7 @@

Returns
The new array. NULL if input is invalid or memory allocation failed.
Example
const int8_t vals[3] = { -1, 0, 1 };
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_sint8(yyjson_mut_doc *doc, const int8_t *vals, size_t count)
Definition: yyjson.h:5942
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_sint8(yyjson_mut_doc *doc, const int8_t *vals, size_t count)
Definition: yyjson.h:5949
@@ -5903,7 +5905,7 @@

Warning
The input strings are not copied, you should keep these strings unmodified for the lifetime of this JSON document. If these strings will be modified, you should use yyjson_mut_arr_with_strcpy() instead.
Example
const char *vals[3] = { "a", "b", "c" };
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_str(yyjson_mut_doc *doc, const char **vals, size_t count)
Definition: yyjson.h:6022
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_str(yyjson_mut_doc *doc, const char **vals, size_t count)
Definition: yyjson.h:6029
@@ -5951,7 +5953,7 @@

Returns
The new array. NULL if input is invalid or memory allocation failed.
Example
const char *vals[3] = { "a", "b", "c" };
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_strcpy(yyjson_mut_doc *doc, const char **vals, size_t count)
Definition: yyjson.h:6042
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_strcpy(yyjson_mut_doc *doc, const char **vals, size_t count)
Definition: yyjson.h:6049
@@ -6008,7 +6010,7 @@

Example
const char *vals[3] = { "a", "bb", "c" };
const size_t lens[3] = { 1, 2, 1 };
yyjson_mut_val *arr = yyjson_mut_arr_with_strn(doc, vals, lens, 3);
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_strn(yyjson_mut_doc *doc, const char **vals, const size_t *lens, size_t count)
Definition: yyjson.h:6032
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_strn(yyjson_mut_doc *doc, const char **vals, const size_t *lens, size_t count)
Definition: yyjson.h:6039
@@ -6111,7 +6113,7 @@

Returns
The new array. NULL if input is invalid or memory allocation failed.
Example
const uint64_t vals[3] = { 0, 1, 0 };
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_uint(yyjson_mut_doc *doc, const uint64_t *vals, size_t count)
Definition: yyjson.h:5932
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_uint(yyjson_mut_doc *doc, const uint64_t *vals, size_t count)
Definition: yyjson.h:5939
@@ -6159,7 +6161,7 @@

Returns
The new array. NULL if input is invalid or memory allocation failed.
Example
const uint16_t vals[3] = { 0, 1, 0 };
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_uint16(yyjson_mut_doc *doc, const uint16_t *vals, size_t count)
Definition: yyjson.h:5982
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_uint16(yyjson_mut_doc *doc, const uint16_t *vals, size_t count)
Definition: yyjson.h:5989
@@ -6207,7 +6209,7 @@

Returns
The new array. NULL if input is invalid or memory allocation failed.
Example
const uint32_t vals[3] = { 0, 1, 0 };
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_uint32(yyjson_mut_doc *doc, const uint32_t *vals, size_t count)
Definition: yyjson.h:5990
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_uint32(yyjson_mut_doc *doc, const uint32_t *vals, size_t count)
Definition: yyjson.h:5997
@@ -6255,7 +6257,7 @@

Returns
The new array. NULL if input is invalid or memory allocation failed.
Example
const uint64_t vals[3] = { 0, 1, 0 };
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_uint64(yyjson_mut_doc *doc, const uint64_t *vals, size_t count)
Definition: yyjson.h:5998
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_uint64(yyjson_mut_doc *doc, const uint64_t *vals, size_t count)
Definition: yyjson.h:6005
@@ -6303,7 +6305,7 @@

Returns
The new array. NULL if input is invalid or memory allocation failed.
Example
const uint8_t vals[3] = { 0, 1, 0 };
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_uint8(yyjson_mut_doc *doc, const uint8_t *vals, size_t count)
Definition: yyjson.h:5974
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_uint8(yyjson_mut_doc *doc, const uint8_t *vals, size_t count)
Definition: yyjson.h:5981
@@ -8583,7 +8585,7 @@

Adds a string value at the end of the object. The key should be a null-terminated UTF-8 string. The val should be a UTF-8 string, null-terminator is not required. The len should be the length of the val, in bytes. This function allows duplicated key in one object.

-
Warning
The key/value strings are not copied, you should keep these strings unmodified for the lifetime of this JSON document.
+
Warning
The key strings are not copied, you should keep these strings unmodified for the lifetime of this JSON document.
@@ -9534,7 +9536,7 @@

Warning
The input string is not copied, you should keep this string unmodified for the lifetime of this JSON document.
Example
const char *kv_pairs[4] = { "id", "01", "name", "Harry" };
yyjson_mut_val *obj = yyjson_mut_obj_with_kv(doc, kv_pairs, 2);
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_with_kv(yyjson_mut_doc *doc, const char **kv_pairs, size_t pair_count)
Definition: yyjson.h:6596
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_with_kv(yyjson_mut_doc *doc, const char **kv_pairs, size_t pair_count)
Definition: yyjson.h:6603
@@ -9581,7 +9583,7 @@

Example
const char *keys[2] = { "id", "name" };
const char *vals[2] = { "01", "Harry" };
yyjson_mut_val *obj = yyjson_mut_obj_with_str(doc, keys, vals, 2);
-
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_with_str(yyjson_mut_doc *doc, const char **keys, const char **vals, size_t count)
Definition: yyjson.h:6565
+
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_with_str(yyjson_mut_doc *doc, const char **keys, const char **vals, size_t count)
Definition: yyjson.h:6572
@@ -12288,7 +12290,7 @@

-

Set provided value if the JSON Pointer (RFC 6901) exists and is type sint. Returns true if value at ptr exists and is the correct type, otherwise false.

+

Set provided value if the JSON Pointer (RFC 6901) exists and is an integer that fits in int64_t. Returns true if successful, otherwise false.

@@ -12358,7 +12360,7 @@

-

Set provided value if the JSON Pointer (RFC 6901) exists and is type uint. Returns true if value at ptr exists and is the correct type, otherwise false.

+

Set provided value if the JSON Pointer (RFC 6901) exists and is an integer that fits in uint64_t. Returns true if successful, otherwise false.

@@ -12665,7 +12667,7 @@

yyjson_doc_free(doc);
free(buf);
-
yyjson_api_inline void yyjson_doc_free(yyjson_doc *doc)
Definition: yyjson.h:4829
+
yyjson_api_inline void yyjson_doc_free(yyjson_doc *doc)
Definition: yyjson.h:4833
yyjson_api_inline size_t yyjson_read_max_memory_usage(size_t len, yyjson_read_flag flg)
Definition: yyjson.h:981
See also
yyjson_alc_pool_init()
@@ -14350,7 +14352,7 @@

- +
const yyjson_read_flag YYJSON_READ_NOFLAG = 0 << 0const yyjson_read_flag YYJSON_READ_NOFLAG = 0

+ + + + +
+ + + + +
const yyjson_write_flag YYJSON_WRITE_NEWLINE_AT_END = 1 << 7
+
+static
+
+

Adds a newline character \n at the end of the JSON. This can be helpful for text editors or NDJSON.

+
@@ -14726,7 +14751,7 @@

- +
const yyjson_write_flag YYJSON_WRITE_NOFLAG = 0 << 0const yyjson_write_flag YYJSON_WRITE_NOFLAG = 0
diff --git a/doc/doxygen/html/yyjson_8h.js b/doc/doxygen/html/yyjson_8h.js index 59ce63d..2187a73 100644 --- a/doc/doxygen/html/yyjson_8h.js +++ b/doc/doxygen/html/yyjson_8h.js @@ -500,6 +500,7 @@ var yyjson_8h = [ "YYJSON_WRITE_ESCAPE_SLASHES", "yyjson_8h.html#a0eeb35b40e688fce9dd61ed400984042", null ], [ "YYJSON_WRITE_ESCAPE_UNICODE", "yyjson_8h.html#ac234e82f7a1203e656bcbb0af2ce8c01", null ], [ "YYJSON_WRITE_INF_AND_NAN_AS_NULL", "yyjson_8h.html#a4408e0c5928db936b89d49ccf255100b", null ], + [ "YYJSON_WRITE_NEWLINE_AT_END", "yyjson_8h.html#ab0cfae40d7ae6489d73c6cf5db9c09e1", null ], [ "YYJSON_WRITE_NOFLAG", "yyjson_8h.html#ae152a6e8e8c6e4efd798fa6eca9d311f", null ], [ "YYJSON_WRITE_PRETTY", "yyjson_8h.html#aebdaa55a1673e99d2dcea01a15c633be", null ], [ "YYJSON_WRITE_PRETTY_TWO_SPACES", "yyjson_8h.html#a7b13411e137d8085b68b2e0fc9d6736b", null ], diff --git a/src/yyjson.h b/src/yyjson.h index 8f727e9..64c4474 100644 --- a/src/yyjson.h +++ b/src/yyjson.h @@ -527,16 +527,16 @@ extern "C" { #define YYJSON_VERSION_MAJOR 0 /** The minor version of yyjson. */ -#define YYJSON_VERSION_MINOR 8 +#define YYJSON_VERSION_MINOR 9 /** The patch version of yyjson. */ #define YYJSON_VERSION_PATCH 0 /** The version of yyjson in hex: `(major << 16) | (minor << 8) | (patch)`. */ -#define YYJSON_VERSION_HEX 0x000800 +#define YYJSON_VERSION_HEX 0x000900 /** The version string of yyjson. */ -#define YYJSON_VERSION_STRING "0.8.0" +#define YYJSON_VERSION_STRING "0.9.0" /** The version of yyjson in hex, same as `YYJSON_VERSION_HEX`. */ yyjson_api uint32_t yyjson_version(void);