sanitizers {loggit2} | R Documentation |
Sanitization for ndJSON.
Description
Sanitizer and unsanitizer are needed because the ndjson
format requires that each line be a valid JSON object,
thus special characters must be escaped. The functions worke in such a way that the concatenation
unsanitizer(sanitizer())
corresponds to the identity function.
Usage
default_ndjson_sanitizer(string)
default_ndjson_unsanitizer(string)
Arguments
string |
A character vector. |
Details
The default sanatizer and unsanatizer are based on the following mapping:
Character | Replacement |
\ | \\ |
" | \" |
\r | \\r |
\n | \\n |
Value
A character vector.
Examples
## Not run:
default_ndjson_sanitizer('This is \n an "example"')
default_ndjson_unsanitizer('This is \\n an \\"example\\"')
## End(Not run)
[Package loggit2 version 2.3.1 Index]