h2non / jsonpath-ng

Finally, a JSONPath implementation for Python that aims to be standard compliant. That's all. Enjoy!
Apache License 2.0
572 stars 85 forks source link

Parse the data from JSON file without loading the whole JSON file #87

Closed machineCYC closed 1 year ago

machineCYC commented 3 years ago

Since I have a big JSON file(20GB), I want to parse the data from that JSON file, but I do not want to load the whole JSON file

So, I only have the JSON file path, and I want to get the specific data in JSON file

such as below is a JSON file, I want to parse the "ColC" data

data = {
    "ColA":"XXX",
    "ColA":"XXX",
    "ColB":"XXX",
    "ColC":[
        {"ColC1":"ZZZ1", "time":"TTT1"},
        {"ColC2":"ZZZ2", "time":"TTT2"},
        {"ColC3":"ZZZ3", "time":"TTT3"},
        {"ColC4":"ZZZ4", "time":"TTT4"},
        ...
        {"ColC100000":"ZZZ100000", "time":"TTT100000"},
    ],
    "ColD":[
        {"ColD1":"ZZZ1", "time":"TTT1"},
        {"ColD2":"ZZZ2", "time":"TTT2"},
        {"ColD3":"ZZZ3", "time":"TTT3"},
        {"ColD4":"ZZZ4", "time":"TTT4"},
        ...
        {"ColD100000":"ZZZ100000", "time":"TTT100000"},
    ],
    "ColE":"XXX",
    "ColF":"XXX",
    ....
    "ColZ":"XXX",
}

I am not sure jsonpath-ng can do this or not,

have any examples can share with me?

1wang-wood commented 1 year ago

jsonpath can't do this, maybe you should write a python script to do this

machineCYC commented 1 year ago

finally, use other way to handle this, thanks

wenbindu commented 1 year ago

can u share the solution? appreciate it.

michaelmior commented 1 year ago

Closing since this is currently not a use case jsonpath_ng attempts to handle.