Parse a JSON5 string into a JavaScript value.
JSON5 is a superset of JSON based on ECMAScript 5.1 that supports comments, trailing commas, unquoted keys, single-quoted strings, hex numbers, Infinity, NaN, and more.
function
Parse a JSON5 string into a JavaScript value.
JSON5 is a superset of JSON based on ECMAScript 5.1 that supports comments, trailing commas, unquoted keys, single-quoted strings, hex numbers, Infinity, NaN, and more.
The JSON5 string to parse
A JavaScript value
import { JSON5 } from "bun";
const result = JSON5.parse(`{
// This is a comment
name: 'my-app',
version: '1.0.0', // trailing comma is allowed
hex: 0xDEADbeef,
half: .5,
infinity: Infinity,
}`);