Edit this page

up.util up.util.parseRelaxedJSON(text)
JavaScript function

This feature is experimental. Please share your experiences so we know what to keep or change.

Parses a string of relaxed JSON into a JavaScript value.

Example

let value = up.util.parseRelaxedJSON("{ foo: 'one', bar: 'two', }")
console.log(value) // logs an object { foo: 'one', bar: 'two' }

Syntax errors

When the passed text is not in Relaxed JSON format, a SyntaxError is thrown.


Parameters

text string

The text to parse.

Return value

Object|Array|string|number|boolean|null

The parsed JSON value.