Hi all,


I'm trying an example (in attached file).

First, I create a list of 3 objects. Then I do:


PutJSONObjects(objects)
objects = GetJSONObjects()
PutJSONObjects(objects, "objects2.json")


1) PutJSONObjects(objects) method creates objects.json file (by default). It
works fine.
2) Then objects = GetJSONObjects() method get the file contents and return.

3) Finally the script fails on the third method PutJSONObjects(objects,
"objects2.json")
saying: AttributeError: 'dict' object has no attribute '__dict__'


That is true, because objects returned by GetJSONObjects() is not a list of
objects, but simple string....

So here is the question, please, how should I DECODE .json file into list of
python objects so that I will be able to put the copy of these objects into
a new file called objects2.json ?

simplejson <http://simplejson.github.com/simplejson/> docs are hard to
follow - without examples.



Please, help me. Be happy!

Bart

Attachment: cache.py
Description: Binary data

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to