diff options
| author | Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> | 2025-05-15 22:01:59 -0300 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-05-16 09:33:07 -0700 |
| commit | da692298ac64a835378237ed4870737fb19552fc (patch) | |
| tree | 4c44af997055697664c7ef60b2ef5c28a279918e | |
| parent | fba60a4841ce2185200e82cdb80428e9819233f8 (diff) | |
| download | git-da692298ac64a835378237ed4870737fb19552fc.tar.gz | |
json-writer: describe the usage of jw_* functions
Provide an overview of the set of functions used for manipulating
`json_writer`s, by describing what functions should be used for
each JSON-related task.
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Patrick Steinhardt <ps@pks.im>
Helped-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Acked-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
| -rw-r--r-- | json-writer.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/json-writer.h b/json-writer.h index 0e8e6c3ddc..8f845d4d29 100644 --- a/json-writer.h +++ b/json-writer.h @@ -28,6 +28,34 @@ * object/array) -or- by building them inline in one pass. This is a * personal style and/or data shape choice. * + * USAGE: + * ====== + * + * - Initialize the json_writer with jw_init. + * + * - Open an object as the main data structure with jw_object_begin. + * Append a key-value pair to it using the jw_object_<type> functions. + * Conclude with jw_end. + * + * - Alternatively, open an array as the main data structure with + * jw_array_begin. Append a value to it using the jw_array_<type> + * functions. Conclude with jw_end. + * + * - Append a new, unterminated array or object to the current + * object using the jw_object_inline_begin_{array, object} functions. + * Similarly, append a new, unterminated array or object to + * the current array using the jw_array_inline_begin_{array, object} + * functions. + * + * - Append other json_writer as a value to the current array or object + * using the jw_{array, object}_sub_jw functions. + * + * - Extend the current array with an null-terminated array of strings + * by using jw_array_argv or with a fixed number of elements of a + * array of string by using jw_array_argc_argv. + * + * - Release the json_writer after using it by calling jw_release. + * * See t/helper/test-json-writer.c for various usage examples. * * LIMITATIONS: |
