본문으로 건너뛰기

getJSONPath

Generates a JSONPath from the root object to the target object. JSONPath is a query language for JSON similar to XPath for XML.

Signature

const getJSONPath: <Root extends object, Target>(root: Root, target: Target) => string | null

Parameters

NameTypeDescription
root-Root object to start the search from
target-Target object to find

Returns

JSONPath string to the target object or null if not found