Greetings, Hopefully this is something dumb I'm doing but simplejson
is reording my lists/arrays. Has anyone seen this? Know how to fix?
The scenario is I am placing tags and GLatLngs into db.ListProperties.
However I've noticed that when written into the table the list is no
longer in proper order which is a major problem for the GLatLngs....
Specifically what appears to be happening and consistent is passing
the following json string to simplejson:
"tags": {
"0": "testtag 0",
"1": "testtag 1",
"2": "testtag 2",
"3": "testtag 3",
"4": "testtag 4"
}
I get reordered data back such as:
"tags": {"1":"testtag 1", "0":"testtag 0","3":"testtag 3","2":"testtag
2","4":"testtag 4"}
This reordered pattern(1,0,3,2,4...) occurs for everything through
simplejson. I've checked the input/output and removed simplejson to
isolate it to simplejson doing the reordering.
Code snippet below:
if request.method == "POST":
data = request.POST['map']
json = simplejson.loads(data)
my_map = Map()
tags = json['tags']
for tag, tagname in tags.iteritems():
my_map.tags.append(tagname)
my_map.save()
Any help will be greatly appreciated. I'm looking at how to reorder
data back, but ideally want to stop the json reordering.
thx,
Dave
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---