Skip to main content

@terascope/utils / json

json

Functions

parseJSON()

parseJSON<T>(buf): T

JSON encoded buffer into a json object

Type parameters

Type parameterValue
TRecord<string, unknown>

Parameters

ParameterType
bufstring | Buffer

Returns

T

Source

packages/utils/src/json.ts:15


toJSONCompatibleValue()

toJSONCompatibleValue(input): any

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

Source

packages/utils/src/json.ts:30


tryParseJSON()

tryParseJSON<T>(input): T

Type parameters

Type parameterValue
Tany

Parameters

ParameterType
inputunknown

Returns

T

Source

packages/utils/src/json.ts:6