How about something like:
import json
data = json.loads(json_api_response)['data']
Now you have a list of dictionaries.
Anthony
On Friday, July 15, 2016 at 2:48:09 AM UTC-4, pbreit wrote:
>
> I can't seem to figure out how to convert the JSON that I'm getting back
> from an API call to a Web2py dict that I can use in a view like I do a set
> of rows from a DB query.
>
>
> {
> "data": [
> {
> "id": "564b95645250790600479164",
> "client_id": "55948892bda24f0c0086b64a",
> "recipient_id": "564b95645250790600479162",
> "recipient": {
> "id": "564b95645250790600479162",
> "kyc_level": 0,
> "requires_kyc_level": 2,
> "remote_id": "rid564b95645250790600479161",
> "primary_wallet_id": null,
> "status": "active",
> "verified": "verified",
> "type": "company",
> "name": "Beatty-Rowe",
> "first_name": "",
> "last_name": "",
> "email": "[email protected]",
> "registration_office": "",
> "occupation": "",
> "facebook": "",
> "revenue": "",
> "legal_structure": "",
> "industry": "",
> "place_of_birth": "",
> "nationality": "",
> "gender": "",
> "country": "US",
> "description": "",
> "address": "",
> "city": "",
> "state": "",
> "postalcode": "",
> "tags": "",
> "dob_year": 1938,
> "dob_month": 8,
> "dob_day": 4,
> "ofac_at": 1447794033,
> "created_at": 1445917135,
> "updated_at": 1447794033,
> "accepted_terms": false,
> "onboard_step": "step1",
> "onboard": "new",
> "onboard_at": "",
> "restricted_international": false
> },
> "wallet_id": "564b95645250790600479163",
> "ref_id": "1447794020410-169933",
> "currency": "USD",
> "amount": 10401,
> "status": "submitted",
> "source_country": "US",
> "source_currency": "USD",
> "source_amount": 10401,
> "destination_country": "US",
> "destination_currency": "USD",
> "destination_amount": 10401,
> "created_at": 1447767779,
> "updated_at": 1447794020
> },
> {
> "id": "564b95635250790600479142",
> "client_id": "55948892bda24f0c0086b64a",
> "recipient_id": "564b95635250790600479138",
> "recipient": {
> "id": "564b95635250790600479138",
> "kyc_level": 0,
> "requires_kyc_level": 2,
> "remote_id": "rid564b95635250790600479137",
> "primary_wallet_id": null,
> "status": "active",
> "verified": "verified",
> "type": "individual",
> "name": "",
> "first_name": "Charlotte",
> "last_name": "Lang",
> "email": "[email protected]",
> "registration_office": "",
> "occupation": "",
> "facebook": "",
> "revenue": "",
> "legal_structure": "",
> "industry": "",
> "place_of_birth": "",
> "nationality": "",
> "gender": "",
> "country": "US",
> "description": "",
> "address": "",
> "city": "",
> "state": "",
> "postalcode": "",
> "tags": "",
> "dob_year": 1923,
> "dob_month": 8,
> "dob_day": 24,
> "ofac_at": 1447794019,
> "created_at": 1432848743,
> "updated_at": 1447794019,
> "accepted_terms": false,
> "onboard_step": "step1",
> "onboard": "new",
> "onboard_at": "",
> "restricted_international": false
> },
> "wallet_id": "564b95635250790600479139",
> "ref_id": "1447794019431-9770701",
> "currency": "USD",
> "amount": 6946,
> "status": "submitted",
> "source_country": "US",
> "source_currency": "USD",
> "source_amount": 6946,
> "destination_country": "US",
> "destination_currency": "USD",
> "destination_amount": 6946,
> "created_at": 1447744994,
> "updated_at": 1447794019
> }
> ]
> }
>
>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.