fun parse(string: String): JsonValue
Parses the given input string as JSON. The input must contain a valid JSON value, optionally padded with whitespace.
string
- the input string, must be valid JSON
ParseException
- if the input is not valid JSON
Return
a value that represents the parsed JSON
fun parse(reader: Reader): JsonValue
Reads the entire input from the given reader and parses it as JSON. The input must contain a valid JSON value, optionally padded with whitespace.
Characters are read in chunks into an input buffer. Hence, wrapping a reader in an additional
BufferedReader
likely won't improve reading performance.
reader
- the reader to read the JSON value from
IOException
- if an I/O error occurs in the reader
ParseException
- if the input is not valid JSON
Return
a value that represents the parsed JSON