Skip to main content

Unwrap JSON responses from callback fns

Project description

# unwrap [![Build Status](https://travis-ci.org/shaunvxc/unwrap.svg?branch=master)](https://travis-ci.org/shaunvxc/unwrap) [![PyPI version](https://badge.fury.io/py/unwrapper.svg)](https://badge.fury.io/py/unwrapper)

`unwrapper` is a small utility for unwrapping the callback function from an otherwise easily parseable `json` string.

###Usage
Simply pass the in the string to be unwrapped:

```python
from unwrapper import unwrap

print unwrap("json13123({'a':1, 'b': 2, 'c': 3})")
# this will output: {'a':1, 'b': 2, 'c': 3}
```

Once the callback is removed, the JSON can be be parsed into a much more useful format like so:

```python
import json
from unwrapper import unwrap

data = json.loads(unwrap("json13123({'a':1, 'b': 2, 'c': 3})"))
print data['b'] # prints 2
```

####Command Line

`$ curl "SOME CURL REQUEST RETURNING WRAPPED JSON" | unwrap`

###Installation

`$ pip install unwrapper`

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

unwrapper-0.0.3.tar.gz (3.3 kB view hashes)

Uploaded Source

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