Skip to contents

Check if the provided string is in valid JSON format.

Usage

is_json(input_string)

Arguments

input_string

A character string to be checked for JSON format.

Value

A logical value. If the input string is in valid JSON format, returns TRUE, otherwise returns FALSE.

Author

Ulrich Matter umatter@protonmail.com

Examples

is_json('{"name": "John", "age": 30}')
#> [1] TRUE
# TRUE

is_json('{"name": "John", age: 30}')
#> [1] FALSE
# FALSE

is_json('')
#> Empty string provided.
#> [1] FALSE
# FALSE