Skip to content

Json.parse

Parses a JSON string, with support for bigint.

Imports

Named
import { Json } from 'ox'

Examples

import { Json } from 'ox'
 
const json = Json.parse('{"foo":"bar","baz":"69420694206942069420694206942069420694206942069420#__bigint"}')
{
foo: 'bar',
baz: 69420694206942069420694206942069420694206942069420n
}

Definition

function parse(
  string: string,
  reviver?: ((this: any, key: string, value: any) => any) | undefined,
): any

Source: src/Json.ts

Parameters

string

  • Type: string

The value to parse.

reviver

  • Type: ((this: any, key: string, value: any) => any) | undefined
  • Optional

A function that transforms the results.

Return Type

The parsed value.

any