safe_convert_json: Convert a JSON-encoded vector to a list, ignoring all errors.

View source: R/utils-parsers.R

safe_convert_jsonR Documentation

Convert a JSON-encoded vector to a list, ignoring all errors.

Description

Note that you should really understand what is in that vector, because this function will discard all errors and replace them with an empty list. The successfully converted vector will be a vector of lists. Each list will have keys corresponding to the JSON keys. If you pass this a JSON string with no keys (e.g. an array or number) it will probably work, but it wasn't built to do that.

Usage

safe_convert_json(json_col)

Value

A vector of lists, where each list has keys corresponding to keys in the JSON. It will use jsonlite::parse_json() and if it encounters an error, the error is discarded and replaced with an empty list.


UCLATALL/CourseKataData documentation built on Dec. 4, 2023, 2:25 a.m.