Utility Library for handling JSONPath and navigating JSON structures
The article showcases a utility library called "pathetic" that is designed to handle JSONPath and navigate JSON structures. The library provides core functions that can be used to parse JSONPath strings, retrieve key paths and values from JSON data, and create a map associating JSON paths with their corresponding values.
Developers can easily integrate the "pathetic" library into their projects by adding it to the :deps map in their deps.edn file. The library accepts JSON data converted to EDN format with string keys.
The core functions of the "pathetic" API are located in the com.yetanalytics.pathetic namespace. These functions have two versions: regular and starred. The regular versions accept JSONPath strings, while the starred versions accept parsed paths for improved performance.
The article also provides examples of how to use the core functions, including parse-paths, get-paths, get-values, get-path-value-map, and select-keys-at. Each function has its own set of supported options that can be passed as arguments.
Overall, the "pathetic" library offers a convenient and efficient solution for handling JSONPath and navigating JSON structures, making it a valuable tool for developers working with JSON data.