import json, string, re
json_data=open('Route 100.json')
data = json.load(json_data)
data_01 = data['layers']
map_name = data_01[0]['name']
map_width = data_01[0]['width'] * 32;
map_height = data_01[0]['height'] * 32;
map_data = data_01[0]['data']
print("Map Name : ", map_name)
print("Map Width : ", map_width)
print("Map Height : ", map_height)
print("Map Output -")
print(map_data)
print("Converted Output")
new_map_data = map_data
def replace_all(text, dic):
for i, j in dic.iteritems():
text = text.replace(i,j)
return text
reps = {'[':'', ' ':'', ']':''}
output = replace_all(new_map_data, reps)
print(output)
json_data.close()
input("\n\nPress any button to exit")
and i need to replace the [ and ] and blank spaces in new_map_data or map_data
im really new to python so if you could fix this for me it would mean a lot
ill attach the file i was using
NOTE i had to rename 'Route 100.json' to 'Route 100.txt' since gamedev dont allow json file uploads
Attached Files
Edited by MrPhoenix, 22 January 2013 - 02:32 PM.








