@winglet/json
Version:
TypeScript library for safe and efficient JSON data manipulation with RFC 6901 (JSON Pointer) and RFC 6902 (JSON Patch) compliance, featuring prototype pollution protection and immutable operations
16 lines (15 loc) • 596 B
TypeScript
/**
* Converts JSON Pointer format to AJV dataPath format.
*
* @param jsonPointer - JSON Pointer string to convert (e.g., "/data/users/0/name")
* @returns AJV dataPath format string (e.g., ".data.users[0].name")
*
* @example
* ```ts
* convertJsonPointerToPath('/data/users/0/name') // '.data.users[0].name'
* convertJsonPointerToPath('/items/-/id') // '.items[].id'
* convertJsonPointerToPath('/0/value') // '.[0].value'
* convertJsonPointerToPath('/') // '.'
* ```
*/
export declare const convertJsonPointerToPath: (jsonPointer: string) => string;