Skip to content

json

json

Type Aliases

JsonPatchOperation

type JsonPatchOperation = object;

Defined in: json/index.ts:1

Properties

Property Type Defined in
op "add" | "remove" | "replace" json/index.ts:2
path string json/index.ts:3
value? unknown json/index.ts:4

Functions

deepDiff()

function deepDiff(
   a, 
   b, 
   basePath?): JsonPatchOperation[];

Defined in: json/index.ts:39

Parameters

Parameter Type Default value
a unknown undefined
b unknown undefined
basePath string ''

Returns

JsonPatchOperation[]


safeParse()

function safeParse(json): unknown;

Defined in: json/index.ts:14

Parse a JSON string, returning null on failure.

Returns unknown — callers must narrow the result (e.g. with a Zod schema or a type guard) before treating it as a concrete type. This is the unvalidated boundary parse; structured validation belongs at the call site.

Parameters

Parameter Type
json string

Returns

unknown


safeStringify()

function safeStringify(value, space?): string;

Defined in: json/index.ts:23

Parameters

Parameter Type
value unknown
space? number

Returns

string