Your question is incomprehensible, but you probably want something like this:
>>> r = DataResult() >>> r.add_poi(-34.96615974838191, 149.89967626953126) >>> r.add_locale(-34.72271328279892, 150.46547216796876) >>>r.add_poi(-34.67303411621243, 149.96559423828126) >>> print r {"data": [{"type": "locale", "lat": -34.43778387240597, "lon": 150.04799169921876}, {"type": "poi", "lat": -34.96615974838191, "lon": 149.89967626953126}, {"type": "locale", "lat": -34.72271328279892, "lon": 150.46547216796876}, {"type": "poi", "lat": -34.67303411621243, "lon": 149.96559423828126}]}
You can create this by creating the DataResult class and overriding the __str__ or __unicode__ .
Your add_poi might look something like this:
def add_poi(self, lat, lon): self.append(PoiData(lat, lon))
where PoiData is another class representing a data record of type "poi", etc.
source share