<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

### Table of Contents

*   [JSON][1]
    *   [type][2]
    *   [get][3]
    *   [expand][4]
    *   [path][5]
        *   [Parameters][6]
    *   [toObject][7]
    *   [toObjectAsync][8]
    *   [proxify][9]
    *   [parse][10]
        *   [Parameters][11]
    *   [parseAsync][12]
        *   [Parameters][13]
    *   [latency][14]
    *   [simdjson\_version][15]
    *   [simd][16]
    *   [symbolToObject][17]
    *   [symbolToObjectAsync][18]
    *   [symbolType][19]

## JSON

A binary representation of a JSON element

### type

The underlying type of the JSON element.

Type: (`"object"` | `"array"` | `"string"` | `"number"` | `"boolean"` | `"null"`)

### get

Retrieve a subtree out of the binary JSON object.

Subsequent requests for the same element will return a reference
to the same object for as long as the GC hasn't collected it.

Returns **([string][20] | [boolean][21] | [number][22] | null | [Array][23]<[JSON][1]> | Record<[string][20], [JSON][1]>)**&#x20;

### expand

Retrieve a subtree out of the binary JSON object
automatically expanding primitive values.

Subsequent requests for the same element will return a reference
to the same object for as long as the GC hasn't collected it.

Returns **([Array][23]<([JSON][1] | [string][20] | [boolean][21] | [number][22] | null)> | Record<[string][20], ([JSON][1] | [string][20] | [boolean][21] | [number][22] | null)> | [string][20] | [boolean][21] | [number][22] | null)**&#x20;

### path

Retrieves a deeply nested JSON element referenced by the RFC6901 JSON pointer.

This is much faster than recursing down with .get()/.expand() but
it will still have an O(n) complexity relative to the arrays and objects
sizes since simdjson stores arrays and objects as lists.

Subsequent requests for the same element will return a reference
to the same object for as long as the GC hasn't collected it.

#### Parameters

*   `rfc6901` **[string][20]** RFC6901-conformant JSON pointer
*   `opts` **[object][24]** Options (optional, default `{}`)

    *   `opts.throwOnError` **[boolean][21]** Throw on error when true, return undefined when false (optional, default `true`)

Returns **any**&#x20;

### toObject

Converts the binary representation to a JS object.

Will block the event loop while the conversion is running.
Significantly slower than the built-in JSON parser but
allows to convert only a small subtree out of a larger
document.

Returns **any**&#x20;

### toObjectAsync

Converts the binary representation to a JS object.

Uses the main thread, but periodically yields the CPU
to allow other tasks to run.

Allows to convert only a small subtree out of a larger
document.

Returns **[Promise][25]\<any>**&#x20;

### proxify

Creates a Proxy object that gives the illusion of a real object.

This is an instantaneous zero-latency method for creating a
`Proxy` object that works (almost) like a real object but
calls .expand() when needs to retrieve a property.

Returns **any**&#x20;

### parse

Parse a string and return its binary representation.

Will block the event loop while it parses the JSON. Slightly
slower for small files but faster for larger files compared
to the built-in JSON parser.

#### Parameters

*   `text` **[string][20]** JSON to parse

Returns **[JSON][1]**&#x20;

### parseAsync

Parse a string and return its binary representation.

Unlike the built-in JSON parser, it does not incur any latency
on the event loop while it parses the JSON. Slightly slower for
small files but faster for larger files compared to the built-in
JSON parser.

#### Parameters

*   `text` **[string][20]** JSON to parse

Returns **[Promise][25]<[JSON][1]>**&#x20;

### latency

Allows to change the default latency limit.

CPU will be yielded every `latency` milliseconds.

Type: [number][22]

### simdjson\_version

The currently used simdjson version.

Type: [string][20]

### simd

The currently used SIMD implementation.

Type: (`"icelake"` | `"haswell"` | `"westmere"` | `"arm64"` | `"ppc64"` | `"fallback"`)

### symbolToObject

Symbol.toObject to be used for Proxies

Type: any

### symbolToObjectAsync

Symbol.toObjectAsync to be used for Proxies

Type: any

### symbolType

Symbol.type to be used for Proxies

Type: any

[1]: #json

[2]: #type

[3]: #get

[4]: #expand

[5]: #path

[6]: #parameters

[7]: #toobject

[8]: #toobjectasync

[9]: #proxify

[10]: #parse

[11]: #parameters-1

[12]: #parseasync

[13]: #parameters-2

[14]: #latency

[15]: #simdjson_version

[16]: #simd

[17]: #symboltoobject

[18]: #symboltoobjectasync

[19]: #symboltype

[20]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String

[21]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean

[22]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number

[23]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array

[24]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object

[25]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
