Example #1
0
        def stream_json(data, length):
            """Generator function to stream JSON data"""
            yield u"["
            start = 1

            for xform in self.object_list.iterator():
                yield json.dumps(XFormBaseSerializer(
                    instance=xform,
                    context={'request': self.request}
                ).data)
                yield "" if start == length else ","
                start += 1

            yield u"]"
Example #2
0
 def get_json_string(item):
     return json.dumps(
         XFormBaseSerializer(instance=item,
                             context={
                                 'request': self.request
                             }).data)