How to use the pyjstat.pyjstat.from_json_stat function in pyjstat

To help you get started, we’ve selected a few pyjstat examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github predicador37 / pyjstat / examples / example.py View on Github external
# -*- coding: utf-8 -*-
""" pyjstat example with 0.3.5-like syntax for JSON-stat 1.3."""

from collections import OrderedDict
import json
import requests
from pyjstat import pyjstat

EXAMPLE_URL = 'http://json-stat.org/samples/us-labor-ds.json'

data = requests.get(EXAMPLE_URL)
results = pyjstat.from_json_stat(data.json(object_pairs_hook=OrderedDict))
print(results)
print(json.dumps(json.loads(pyjstat.to_json_stat(results))))