Skip to main content

Python implementation of jsonselect (http://jsonselect.org/)

Project description

#jsonselect.py

<img src="https://travis-ci.org/mwhooker/jsonselect.png" />

jsonselect.py is a python implementation of https://github.com/fd/json_select

You can find more information here http://jsonselect.org/


## Usage

jsonselect can be called directly from the command line.

`python -m jsonselect <selector> < jsonfile`

This is usefull, for example, for parsing out values from JSON APIs.

```sh
$aws ec2 describe-instances --filters "Name=tag:Name,Values=kafka" | python -m jsonselect .InstanceId
["i-12345678", "i-23456789", "i-3456789A"]
```

### Full Usage

```
usage: __main__.py [-h] [--list | --machine-readable] selector [infile]

parse json with jsonselect.

positional arguments:
selector
infile

optional arguments:
-h, --help show this help message and exit
--list, -l new-line separated list of values. works best on lists.
--machine-readable Print json with no formatting
```


## Project status

jsonselect.py currently implements levels 1 & 2 of these conformance tests https://github.com/lloyd/JSONSelectTests

level 3 is unimplemented because I was having trouble understanding what the correct behavior should be


##Tests

get the upstream conformance tests:
git submodule update --init

Run specific level conformance tests with
nosetests -m '.*_level_1' ./tests/test_conformance.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jsonselect-0.2.2.tar.gz (13.4 kB view details)

Uploaded Source

File details

Details for the file jsonselect-0.2.2.tar.gz.

File metadata

  • Download URL: jsonselect-0.2.2.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for jsonselect-0.2.2.tar.gz
Algorithm Hash digest
SHA256 ebc8e36bdbafa705e2a7c732d20ba1496acb6ecfdb61913cd7f6d2505eab8957
MD5 0f61d9acf5b4ee537b2be2e72242480c
BLAKE2b-256 ec63a912311c169d343ac995c7d50dcbf0b8d6f78f89d5713ea4fd0b09459d79

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page