Reputation: 1949
I have jsonified the django model. e.g.
from django.core import serializers
foos = Foo.objects.all()
data1 = serializers.serialize('json', foos)
I want to add some extra json data to data1, e.g.
from django.utils import simplejson
some_data = {'some_var_1': 'foo'}
data2 = simplejson.dumps(data)
how can I combine data1 and data2. Serializing foos and some_data gives "_meta" not found error.
Upvotes: 2
Views: 1170
Reputation: 341
I think this will solve: (after the line some_data = {'some_var_1': 'foo'})
data3 = simplejson.loads(data1)
data3.append(some_data)
simplejson.dumps(data3)
Upvotes: 1