import json
import pprint
import os


with open('json/test.json') as json_data:
    d = json.load(json_data)
#    print(d)
#    pprint.pprint(d)
    for stat_categories in d["divisionteamstandings"]["division"][0]["teamentry"][0]["stats"]:
        pprint.pprint(stat_categories)

import json
import pprint
import os

#Open the JSON file that includes headers

with open('json/20160927-division-team-standings.json') as file:
    alltext = file.readlines()  #Put each line into a list

for lines in alltext:
    if lines.startswith('{'):
        rawdata = lines
        data = json.loads(rawdata)
        for stat_categories in data["divisionteamstandings"]["division"][0]["teamentry"][0]["stats"]:
            pprint.pprint(stat_categories)

Create JSON importer from raw JSON file including web headers and pretty print all of the stat categories for one file
Create JSON importer from raw JSON file including web headers and pretty print all of the stat categories for one file

  import json
  import pprint
  import os
  
+ #Open the JSON file that includes headers
  
+ with open('json/20160927-division-team-standings.json') as file:
+     alltext = file.readlines()  #Put each line into a list
- with open('json/test.json') as json_data:
-     d = json.load(json_data)
- #    print(d)
- #    pprint.pprint(d)
-     for stat_categories in d["divisionteamstandings"]["division"][0]["teamentry"][0]["stats"]:
-         pprint.pprint(stat_categories)
  
+ for lines in alltext:
+     if lines.startswith('{'):
+         rawdata = lines
+         data = json.loads(rawdata)
+         for stat_categories in data["divisionteamstandings"]["division"][0]["teamentry"][0]["stats"]:
+             pprint.pprint(stat_categories)
+ 
Create JSON importer from raw JSON file including web headers and pretty print all of the stat categories for one file
## Code Before:
import json
import pprint
import os


with open('json/test.json') as json_data:
    d = json.load(json_data)
#    print(d)
#    pprint.pprint(d)
    for stat_categories in d["divisionteamstandings"]["division"][0]["teamentry"][0]["stats"]:
        pprint.pprint(stat_categories)

## Instruction:
Create JSON importer from raw JSON file including web headers and pretty print all of the stat categories for one file
## Code After:
import json
import pprint
import os

#Open the JSON file that includes headers

with open('json/20160927-division-team-standings.json') as file:
    alltext = file.readlines()  #Put each line into a list

for lines in alltext:
    if lines.startswith('{'):
        rawdata = lines
        data = json.loads(rawdata)
        for stat_categories in data["divisionteamstandings"]["division"][0]["teamentry"][0]["stats"]:
            pprint.pprint(stat_categories)
