ctomkow / jsonparse Goto Github PK
View Code? Open in Web Editor NEWA simple JSON key parse library
License: MIT License
A simple JSON key parse library
License: MIT License
The web api needs to be documented properly to create a new release
Include the feature to pipe data into the cli app, like typical *nix tools allow. This would allow for chaining of commands.
curl my.api.with.highly.nested.json.response | jsonparse --find_key_chain ['my', 'key', 'chain']
Also, support the ability to provide a file of JSON as a flag.
jsonparse --file my.json --find_key 'mykey'
Think about how to return the values in order.
find_key(data, 'myk')
would match on the key mykey
. This was prompted by the future cli mode of operation. This would allow piping a large chunk of json into the the cli app and matching on key guesses, in case you haven't fully manually scanned the large json data for the exact key to match beforehand.Currently find_key_chain()
has the *
operator to match all. Lets have an option to pass a list as an element to match multiple.
E.g. [ 'my', 'key', ['chain', 'rope'] ]
returns ['A', 5]
Provide a group_by parameter for the methods to return the found values as part of a two dimensional list. Each found value part of the same dict will be returned as a list. Multiple lists will be returned within a list.
The new find_keys() function currently returns a 2d list. The default behaviour should be changed to return a simple list, and return a 2d list if the group_by parameter is True. The parameter should have a default of False.
Does not affect the key() method, only the key_chain() method.
It would return the parent set (like find_key_value) that contains the specified value.
Not sure why one would search based only on the value, but might be handy.
When pip installing --user, I noticed that the docs and tests folder gets dumped in the parent directory (python3.10) that holds jsonparse library.
If the result is a single list, have a --single flag to return just the JSON type (e.g. a list), not a value in a list. Currently, all JSON types are added to a list, even if it's just one list for consistency. Avoids a [0] or a pop() for nested lists situations. Just avoids dealing with a list result of one item when you know for sure only one value is found. I think this would be a bit cleaner.
The example on pypi shows importing find_value along with the other methods directly from jsonparse. However, it looks like find_value
was not added to __init__.py
, so it can't be imported from here. It has to be imported from jsonparse.functions.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.