how to use json on mac os
<p>i have encountered a very strange issue: i use json.dump to write a file and then use json.load to read the file. </p>

<p>The same code can run succeed on windows 7 but it can not do on mac os x 10.7
Below is the code:  </p>

<pre><code>class Result:
def __init__(self,name,result):
    self.name = name
    self.result = result

def __repr__(self):
    return 'Result  name : %s , result : %s' % (self.name,self.result)

class MyEncoder(json.JSONEncoder):
def default(self,obj):
    #convert object to a dict
    d = {'CaseResult':{}}
    d['CaseResult'][obj.name] = obj.result
    return d


def save(name,result):
    filename = 'basic.json'
    obj = Result(name,result)
    obj_json = MyEncoder().encode(obj)
    with open(filename, mode='ab+') as fp:
        json.dump(obj_json,fp)
        s=json.load(fp)

save('aaa','bbb')
</code></pre>

<p>in mac os it give an error "ValueError:NO JSON object could be decoded"
who can tell me why this happen and how can i resolve it</p>
