Skip to main content

@terascope/utils / json

json

Functions

parseJSON()

parseJSON<T>(buf): T

Defined in: packages/utils/src/json.ts:15

JSON encoded buffer into a json object

Type Parameters

Type ParameterDefault type
TRecord<string, unknown>

Parameters

ParameterType
bufstring | Buffer<ArrayBufferLike>

Returns

T


toJSONCompatibleValue()

toJSONCompatibleValue(input): any

Defined in: packages/utils/src/json.ts:33

This will try to convert any BigInt values to a value that is compatible with JSON, it will iterate through an array, and check all the keys of an object

Parameters

ParameterType
inputunknown

Returns

any


tryParseJSON()

tryParseJSON<T>(input): T

Defined in: packages/utils/src/json.ts:6

Type Parameters

Type ParameterDefault type
Tany

Parameters

ParameterType
inputunknown

Returns

T