def customConvertJson(value):
 if isinstance(value, float):
  return int(value)
 elif isinstance(value, unicode):
  return str(value)
 elif isinstance(value, list):
  return [customConvertJson(item) for item in value]
 elif isinstance(value, dict):
  new_dict = {}
  for (key, val) in value.iteritems():
   new_key = customConvertJson(key)
   new_val = customConvertJson(val)
   new_dict[new_key] = new_val
  return new_dict
 else:
  return value

def customConvertJson ( value ) : if isinstance ( value , float ) : return int ( value ) elif isinstance ( value , unicode ) : return str ( value ) elif isinstance ( value , list ) : return [ customConvertJson ( item ) for item in value ] elif isinstance ( value , dict ) : new_dict = { } for ( key , val ) in value . iteritems ( ) : new_key = customConvertJson ( key ) new_val = customConvertJson ( val ) new_dict [ new_key ] = new_val return new_dict else : return value
recursively process json values and do type conversions .