Fparse
Bun

function

JSON5.parse

function parse(
input: string
): unknown;

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.

@param input

The JSON5 string to parse

@returns

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,
}`);