Enum yajl_gen_option

Enum Documentation

enum yajl_gen_option

Configuration parameters for the parser, these may be passed to yajl_gen_config() along with option-specific argument(s). In general, all configuration parameters default to off.

Values:

enumerator yajl_gen_beautify

Generate indented (beautiful) output.

   yajl_gen_config() argument type: int (boolean)

   Example: \code{.cpp}
   yajl_gen_config(g, yajl_gen_beautify, 1); // Human format please
   \endcode

enumerator yajl_gen_indent_string

Set the indent string which is used when yajl_gen_beautify is enabled, which may only contain whitespace characters such as \t or some number of spaces. The default is four spaces ‘ ‘.

yajl_gen_config() argument type: const char *

The pointer argument passed is stored (not copied) and must remain valid for the lifetime of the handle, or until replaced.

Example:

yajl_gen_config(g, yajl_gen_indent_string, "  "); // 2 spaces

enumerator yajl_gen_print_callback

Set a function and context argument that should be used to output the generated json. The function should conform to the yajl_print_t prototype while the context argument may be any void * of your choosing.

yajl_gen_config() arguments: yajl_print_t, void *

Example:

yajl_gen_config(g, yajl_gen_print_callback, myFunc, myVoidPtr);

enumerator yajl_gen_validate_utf8

Normally the generator does not validate that strings you pass to it via yajl_gen_string() are valid UTF8. Enabling this option will cause it to do so.

yajl_gen_config() argument type: int (boolean)

Example:

yajl_gen_config(g, yajl_gen_validate_utf8, 1); // Check UTF8

enumerator yajl_gen_escape_solidus

The forward solidus (slash or ‘/’ in human) is not required to be escaped in JSON text. By default, YAJL will not escape it in the interest of saving bytes. Setting this flag will cause YAJL to always escape ‘/’ in generated JSON strings.

yajl_gen_config() argument type: int (boolean)

enumerator yajl_gen_json5

JSON5 is an updated version of JSON with additional capabilities. Special numbers such as NaN and Infinity cannot be represented in the original JSON, but are permitted in JSON5. Setting this flag allows YAJL to output the JSON5 representation of these special numbers instead of returning with an error, and to emit map keys that are valid javascript identifiers without quotes.

yajl_gen_config() argument type: int (boolean)

Example:

yajl_gen_config(g, yajl_gen_json5, 1); // Output JSON5