All Projects β†’ jabbalaci β†’ JSON-path

jabbalaci / JSON-path

Licence: MIT license
Find the path of a key / value in a JSON hierarchy easily.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to JSON-path

Richpath
πŸ’ͺ Rich Android Path. 🀑 Draw as you want. πŸŽ‰ Animate much as you can.
Stars: ✭ 2,259 (+2467.05%)
Mutual labels:  path
datoteka
A filesystem toolset and storage implementation for Clojure.
Stars: ✭ 59 (-32.95%)
Mutual labels:  path
storybook-chapters
React Storybook Addon for Hierarchical Substories (Chapters)
Stars: ✭ 46 (-47.73%)
Mutual labels:  hierarchy
Set Value
Set nested values on an object using dot-notation, like 'a.b.c'.
Stars: ✭ 203 (+130.68%)
Mutual labels:  path
Lambda
Physically based renderer written in C++
Stars: ✭ 26 (-70.45%)
Mutual labels:  path
PathOfBuildingAPI
API for Path of Building's build sharing format for builds in Path of Exile.
Stars: ✭ 25 (-71.59%)
Mutual labels:  path
Polymorph
Get Your SVG into Shape!
Stars: ✭ 185 (+110.23%)
Mutual labels:  path
Panda
Create view hierarchies declaratively.
Stars: ✭ 69 (-21.59%)
Mutual labels:  hierarchy
path-data
A gRPC API that exposes various information about the PATH transit system.
Stars: ✭ 29 (-67.05%)
Mutual labels:  path
envs
Easy access of environment variables from Python with support for typing (ex. booleans, strings, lists, tuples, integers, floats, and dicts). Now with CLI settings file converter.
Stars: ✭ 25 (-71.59%)
Mutual labels:  dict
Picasso
Picasso is a high quality 2D vector graphic rendering library. It support path , matrix , gradient , pattern , image and truetype font.
Stars: ✭ 205 (+132.95%)
Mutual labels:  path
Swiftuirouter
Routing in SwiftUI
Stars: ✭ 242 (+175%)
Mutual labels:  path
MARCspec
πŸ“„ MARCspec - A common MARC record path language
Stars: ✭ 21 (-76.14%)
Mutual labels:  path
Exilence
DEPRECATED Tool for Path of Exile that calculates net worth and tracks gear, maps and other statistics for you and your group
Stars: ✭ 200 (+127.27%)
Mutual labels:  path
pathway
A set of APIs to manipulate graphics paths on Android.
Stars: ✭ 162 (+84.09%)
Mutual labels:  path
Virgilio
Virgilio is developed and maintained by these awesome people. You can email us virgilio.datascience (at) gmail.com or join the Discord chat.
Stars: ✭ 13,200 (+14900%)
Mutual labels:  path
jurl
Fast and simple URL parsing for Java, with UTF-8 and path resolving support
Stars: ✭ 84 (-4.55%)
Mutual labels:  path
MultiplatformPlayground
Kotlin Multiplatform project in Jetpack Compose & SwiftUI with shared ViewModel layer and File upload
Stars: ✭ 72 (-18.18%)
Mutual labels:  hierarchy
weel-translate
🚦 εŽη»­ζ›΄ζ–°ε‘εΈƒεˆ° Releases 不再提亀 AMO ζ‰©ε±•εΈ‚εœΊ
Stars: ✭ 57 (-35.23%)
Mutual labels:  dict
path-dsl-rs
A Rust utility DSL and macro to help construct and modify Paths.
Stars: ✭ 19 (-78.41%)
Mutual labels:  path

JSON Path

Find the path of a key / value in a JSON hierarchy easily.

Motivation

When working with big and nested JSON files, sometimes it's very difficult to figure out the path of a key. You open the JSON file in a text editor, find the key / value pair you need, but then it can be a pain to get the full path of the key.

Example

Consider the following JSON file:

{
    "a": 1,
    "b": {
        "c": 2,
        "friends": [
            {
                "best": "Alice"
            },
            {
                "second": "Bob"
            },
            [5, 6, 7],
            [
                {"one": 1},
                {"two": 2}
            ]
        ]
    }
}

JSON Path will traverse it recursively and print every path / value pair:

$ ./jsonpath.py samples/short.json
root['a'] => 1
root['b']['c'] => 2
root['b']['friends'][0]['best'] => 'Alice'
root['b']['friends'][1]['second'] => 'Bob'
root['b']['friends'][2][0] => 5
root['b']['friends'][2][1] => 6
root['b']['friends'][2][2] => 7
root['b']['friends'][3][0]['one'] => 1
root['b']['friends'][3][1]['two'] => 2

The idea is to combine its usage with the Unix command grep. For instance, what's the path of the key that leads to Bob?

$ ./jsonpath.py samples/short.json | grep -i bob
root['b']['friends'][1]['second'] => 'Bob'

Then simply paste it in your application:

>>> d
{'a': 1, 'b': {'c': 2, 'friends': [{'best': 'Alice'}, {'second': 'Bob'}, [5, 6, 7], [{'one': 1}, {'two': 2}]]}}
>>> d['b']['friends'][1]['second']
'Bob'
>>>

Installation

The program was tested under Linux. It only uses the standard library, so you only need to create a virtual environment if you need a development version. With the development version you can do type checking and you can create a standalone executable.

Install the development version:

$ poetry install

Create an EXE

If you want a standalone executable, then issue the command

$ pynt exe

which will create the executable file jsonpath in the dist/ folder. (Note: for this to work, install the dev. version.)

Related Works

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].