sanitizers {loggit2}R Documentation

Sanitization for ndJSON.

Description

Sanitizers and unsanitizers are functions, with one parameter, that convert a character vector (of any length) into another (of the same length). Associated sanitizer and unsanitizer should be constructed 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
⁠{⁠ ⁠__LEFTBRACE__⁠
⁠}⁠ ⁠__RIGHTBRACE__⁠
⁠"⁠ ⁠__DBLQUOTE__⁠
⁠,⁠ ⁠__COMMA__⁠
⁠\r⁠ ⁠__CR__⁠
⁠\n⁠ ⁠__LF__⁠

This type of function is needed because because some characters in a JSON cannot appear unescaped and since loggit2 reimplements its own very simple string-based JSON parser.

Value

A character vector


[Package loggit2 version 2.2.2 Index]