---
name: "up.util.parseRelaxedJSON"
area: "API"
kind: "JavaScript function"
parent: "up.util module"
visibility: "experimental"
url: "https://unpoly.com/api/up.util.parseRelaxedJSON"
---
<nav aria-label="Unpoly docs">[All docs](https://unpoly.com/index.md) · [up.util module](https://unpoly.com/api/up.util.md)</nav>

# up.util.parseRelaxedJSON(text)

**This feature is experimental**. Please [share](https://github.com/unpoly/unpoly/discussions) your experiences so we know what to keep or change.

Parses a string of [relaxed JSON](https://unpoly.com/api/relaxed-json.md) into a JavaScript value.

<nav aria-label="Contents">

#### Contents

- [Example](#example)
- [Syntax errors](#syntax-errors)
- [Parameters](#parameters)
- [Return value](#return-value)

</nav>

## Example {#example}

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

## Syntax errors {#syntax-errors}

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

---

## Parameters {#parameters}

### text {#text}

(required)

The text to parse.

Type: string

---

## Return value {#return-value}

The parsed JSON value.

Type: [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects) | [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) | string | number | boolean | null

