Skip to content

@ecp.eth/sdk


@ecp.eth/sdk / comments / decodeJsonValue

Function: decodeJsonValue()

function decodeJsonValue(value): JsonObject;

Defined in: packages/sdk/src/comments/metadata.ts:311

Decodes a JSON object from encoded metadata bytes

Parameters

value

`0x${string}`

The hex-encoded bytes of the JSON string

Returns

JsonObject

The decoded JSON object

Throws

If the value is not a valid JSON object

Example

const decodedValue = decodeJsonValue("0x0000000000000000000000000000000000000000000000000000000000000000");
console.log(decodedValue);
// { test: true }