Skip to content

Instantly share code, notes, and snippets.

@wilwang
Created August 15, 2013 15:38
Show Gist options
  • Save wilwang/6241860 to your computer and use it in GitHub Desktop.
Save wilwang/6241860 to your computer and use it in GitHub Desktop.
python script to look for a particular file (json), and parse, and print out what I want
import os
import json
def printJsonData(filename):
file = open(filename)
jsonString = file.read()
jsonString = jsonString.replace('\'', '"')
#print(jsonString)
jsonObject = json.loads(jsonString)
print(jsonObject['Namespace'] , '|', jsonObject['ProcPrefix'])
file.close()
dir = 'c:\\svn\\k2\\trunk\\services'
for root, dirs, files in os.walk(dir):
for filename in files:
if filename == "DataLayer.json":
filename = os.path.join(root, filename)
printJsonData(filename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment