docs/Writerside/topics/json.h.md

changeset 1547
12da0654e4a9
parent 1513
4d641c6a2f82
child 1550
19874e606235
equal deleted inserted replaced
1546:c8dd35f3ea53 1547:12da0654e4a9
319 ```C 319 ```C
320 #include <cx/json.h> 320 #include <cx/json.h>
321 321
322 typedef struct cx_json_writer_s { 322 typedef struct cx_json_writer_s {
323 bool pretty; 323 bool pretty;
324 bool sort_members;
325 uint8_t frac_max_digits; 324 uint8_t frac_max_digits;
326 bool indent_space; 325 bool indent_space;
327 uint8_t indent; 326 uint8_t indent;
328 bool escape_slash; 327 bool escape_slash;
329 } CxJsonWriter; 328 } CxJsonWriter;
344 which you may modify to suit your needs. 343 which you may modify to suit your needs.
345 344
346 | Setting | Compact Default | Pretty Default | Description | 345 | Setting | Compact Default | Pretty Default | Description |
347 |-------------------|-----------------|----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------| 346 |-------------------|-----------------|----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
348 | `pretty` | `false` | `true` | If true, the JSON will be formatted with line breaks and tabs or spaces. If false, output is as compact as possible without extra characters. | 347 | `pretty` | `false` | `true` | If true, the JSON will be formatted with line breaks and tabs or spaces. If false, output is as compact as possible without extra characters. |
349 | `sort_members` | `true` | `true` | If false members are written in the order in which they were added. If true, they are sorted lexicographically. |
350 | `frac_max_digits` | 6 | 6 | The maximum number of fractional digits in a number value. | 348 | `frac_max_digits` | 6 | 6 | The maximum number of fractional digits in a number value. |
351 | `indent_space` | ignored | depends on `use_spaces` argument | If true, use spaces for indentation, otherwise use tabs. | 349 | `indent_space` | ignored | depends on `use_spaces` argument | If true, use spaces for indentation, otherwise use tabs. |
352 | `indent` | ignored | 4 | If `indent_space` is `true`, this is the number of spaces per tab. Ignored otherwise. | 350 | `indent` | ignored | 4 | If `indent_space` is `true`, this is the number of spaces per tab. Ignored otherwise. |
353 | `escape_slash` | `false` | `false` | If `true`, the slash character (a.k.a forward solidus: `/`) is also escaped. This is usually only needed when you want to use JSON as part of an HTML attribute. | 351 | `escape_slash` | `false` | `false` | If `true`, the slash character (a.k.a forward solidus: `/`) is also escaped. This is usually only needed when you want to use JSON as part of an HTML attribute. |
354 352

mercurial