yyjson_write_flag {yyjsonr}R Documentation

Advanced: Values for setting internal options directly on YYJSON library

Description

This is a list of integer values used for setting flags on the yyjson code directly. This is an ADVANCED option and should be used with caution.

Usage

yyjson_write_flag

Format

An object of class list of length 9.

Details

Some of these settings overlap and conflict with code needed to handle the translation of JSON values to R.

opts_write_json(yyjson_write_flag = c(write_flag$x, write_flag$y, ...))

YYJSON_WRITE_NOFLAG

Default value.

  • Write JSON minify.

  • Report error on inf or nan number.

  • Report error on invalid UTF-8 string.

  • Do not escape unicode or slash.

YYJSON_WRITE_PRETTY

Write JSON pretty with 4 space indent.

YYJSON_WRITE_ESCAPE_UNICODE

Escape unicode as uXXXX, make the output ASCII only.

YYJSON_WRITE_ESCAPE_SLASHES

Escape '/' as '\/'.

YYJSON_WRITE_ALLOW_INF_AND_NAN

Write inf and nan number as 'Infinity' and 'NaN' literal (non-standard).

YYJSON_WRITE_INF_AND_NAN_AS_NULL

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

YYJSON_WRITE_ALLOW_INVALID_UNICODE

Allow invalid unicode when encoding string values (non-standard). Invalid characters in string value will be copied byte by byte. If YYJSON_WRITE_ESCAPE_UNICODE flag is also set, invalid character will be escaped as U+FFFD (replacement character). This flag does not affect the performance of correctly encoded strings.

YYJSON_WRITE_PRETTY_TWO_SPACES

Write JSON pretty with 2 space indent. This flag will override YYJSON_WRITE_PRETTY flag.

YYJSON_WRITE_NEWLINE_AT_END

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

Examples

write_json_str("hello/there", opts = opts_write_json(
  yyjson_write_flag = yyjson_write_flag$YYJSON_WRITE_ESCAPE_SLASHES
))

[Package yyjsonr version 0.1.20 Index]