Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds support for a
json_verbatim
boolean flag that functions similarly to {jsonlite}'s equivalent flag, addressing #25.When an atomic character vector is passed to {yyjsonr}'s serializer, there's now a check to see if that vector (element) inherits from the "json" class. If the element does and the new
json_verbatim
flag isTRUE
, then the raw string (char*
) is inserted into the growing yyjson JSON doc as-is.There is no check for JSON-validity of this string, so it's up to the user to know that such strings are indeed already valid JSON; this is the same here-be-dragons situation as with the
fast_numerics
flag.In #25, the OP-proposed flag name was
skip_json
, but I thought it'd be useful to actually try to replicate {jsonlite}'s API in this instance and stick withjson_verbatim
, but obviously I defer to @coolbutuseless on naming preferences.Tests are included to handle some basic cases, which can be used for documentation. If it looks like this'll indeed be merged, I can add another commit adding those docs, but figured I'd wait on those until it looks like this will be merged (since perhaps there'll be some discussion and changes along the way).