# Json

Utility functions for working with JSON (with support for `bigint`).

## Examples

Below are some examples demonstrating common usages of the `Json` module:

* [Stringifying JSON](#stringifying-json)

* [Parsing JSON](#parsing-json)

### Stringifying JSON

JSON values can be stringified (with `bigint` support) using [`Json.stringify`](/api/Json/stringify):

```ts twoslash
import { Json } from 'ox'

const json = Json.stringify({
  foo: 'bar',
  baz: 69420694206942069420694206942069420694206942069420n
})
// @log: '{"foo":"bar","baz":69420694206942069420694206942069420694206942069420}'
```

### Parsing JSON

JSON values can be parsed (with `bigint` support) using [`Json.parse`](/api/Json/parse):

```ts twoslash
import { Json } from 'ox'

const value = Json.parse(
  '{"foo":"bar","baz":69420694206942069420694206942069420694206942069420}'
)
// @log: { foo: 'bar', baz: 69420694206942069420694206942069420694206942069420n }
```

## Functions

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`Json.canonicalize`](/api/Json/canonicalize) | Serializes a value to a canonical JSON string as defined by [RFC 8785 (JSON Canonicalization Scheme)](https://www.rfc-editor.org/rfc/rfc8785). |
| [`Json.parse`](/api/Json/parse) | Parses a JSON string, with support for `bigint`. |
| [`Json.stringify`](/api/Json/stringify) | Stringifies a value to its JSON representation, with support for `bigint`. |
