thanks very much, it is what i wanted.
On 10月26日, 下午4时54分, Thomas Guettler <[EMAIL PROTECTED]> wrote:
> You want: '''{"version":...}''' this means you need to
> pass a dictionary to simplejson.dumps()
>
> mydict={"version":...,
> "markers": content,
> }...
> ..dumps(mydict)
>
> Am Freitag, 26. Oktober 2007 10:09 schrieb [EMAIL PROTECTED]:
>
>
>
> > i just want to use JSON in gmap, here is an alterative method for
> > UTF-8 character,
>
> > s = Suburb.objects.all()
>
> > contents = []
> > for ss in s.iterator():
> > contents.append({'html': ss.name,
> > 'label': ss.slug,
> > 'lat':ss.lat,
> > 'lng':ss.lng})
>
> > json = simplejson.dumps(contents, ensure_ascii=False)
> > return HttpResponse(json)
>
> > and the reslut is:
> > [{"lat": -33.864144, "lng": 151.207151, "html": "悉尼", "label":
> > "sydney"},
> > {"lat": -33.795617, "lng": 151.185329, "html": "Chastwood", "label":
> > "chatswood"}]
>
> > i want the result as:
> > {"version":"1.0","encoding":"UTF-8",
> > "feed":{"xmlns":"http://www.w3.org/2005/Atom",
> > "xmlns$openSearch":"http://a9.com/-/spec/opensearchrss/1.0/",
> > "xmlns$gsx":"http://schemas.google.com/spreadsheets/2006/extended",
> > "id":{"$t":"http://spreadsheets.google.com/feeds/list/
> > o16162288751915453340.4402783830945175750/od6/public/values"},
> > "updated":{"$t":"2007-04-03T18:28:50.311Z"},
> > "markers":
>
> > [{"lat": -33.864144, "lng": 151.207151, "html": "悉尼", "label":
> > "sydney"},
> > {"lat": -33.795617, "lng": 151.185329, "html": "Chastwood", "label":
> > "chatswood"}]
>
> > }}
>
> > how to write the code to append string in to contents = []
>
> > thanks!- 隐藏被引用文字 -
>
> - 显示引用的文字 -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" 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/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---