h2non / jsonpath-ng

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

Project status? #52

Closed bitsofinfo closed 1 year ago

bitsofinfo commented 4 years ago

I see quite a few issues/pr's outstanding. Is this project maintained?

tonsV2 commented 3 years ago

I recently tried to used this library but quickly ran into som deal breaking bugs.

I had previously discarded this library because I could make it work. After some trial and error I did make it work though.

Perhaps the below snippet will help others who are in the same situation.

from yamlpath import Processor, YAMLPath
from yamlpath.exceptions import YAMLPathException
from yamlpath.wrappers import ConsolePrinter

def extract_values(data: {}, path: str) -> []:
    class Args:
        debug = True
        verbose = False
        quiet = True

    args = Args()
    log = ConsolePrinter(args)

    try:
        processor = Processor(log, data)
        yaml_path = YAMLPath(path)
        nodes = processor.get_nodes(yaml_path)
        return [n.node for n in nodes]
    except YAMLPathException as ex:
        print(ex)
michaelmior commented 1 year ago

Closing for now since this doesn't represent a particular issue. Feel free to open a new issue with any specific problems you may have.