James,
First thanks for responding. This formatting is really slowing me down.
In answer to your first question, yes the data I'm getting returned is being added successfully to my list in my server -side code (django view). However I don't think I'm formatting stuff correctly because some extra data that I'm adding to the returned data does not appear to be in the right format, when I look at a print of it in my command window. Here's an example of actual data that I've retrieved and am trying to add to my list:
{
u'participations': [],
'status_code': 200,
u'page_views':
{
u'2015-03-01T00:00:00-06:00': 2, u'2015-02-15T20:00:00-06:00': 2, u'2015-02-24T18:00:00-06:00': 2, u'2015-02-15T21:00:00-06:00': 2,
u'2015-02-09T01:00:00-06:00': 3, u'2015-02-04T16:00:00-06:00': 3, u'2015-02-16T12:00:00-06:00': 3, u'2015-02-16T04:00:00-06:00': 2, u'2015-02-10T21:00:00-06:00': 2,
u'2015-01-27T03:00:00-06:00': 2, u'2015-02-15T04:00:00-06:00': 2, u'2015-02-10T20:00:00-06:00': 4, u'2015-01-15T02:00:00-06:00': 3, u'2015-02-23T02:00:00-06:00': 2
},
'name': 'Taran Dees',
'id': '5923'
}
In it all of the data except for status_code, name, and id items that I'm adding, were in the original data returned from my request seems to be in Unicode format. I'm sure my data is the problem since the formatting doesn't look the same here, because the actual data originally returned in json format seems to have all of its keys displaying above in Unicode format. So this is the first thing that I'm pretty sure I need to do to get it at least closer to well-formed json. So presently I'm adding this extra data in a django view with this current code:
status_code = json_data.status_code
rspnsdata = json.loads(json_data.text)
rspnsdata['name'] = str(lstobjct['name'])
rspnsdata['id'] = str(lstobjct['id'])
rspnsdata['status_code'] = status_code
So in the last three statements above I'm unsure how to convert the additional values that I'm adding to the original json data, so that they will be in the proper format, so when I send my final response back to my browser everything will be formatted in well-formed json.
In answer to your question about how I'm sending stuff back to an html page I'm using json.dumps to format all of my "response_data" right before I send it back to the "return HttpResponse(response_data, content_type='application/json'), where my javascript will finish parsing and processing it.
The actual problem or issue that I'm having is that my javascript is seems to be failing whenever I try to execute the following jQuery/javascript code in my html page:
rspdata = jq.parseJSON(data.response_data);
And so for that reason I'm thinking I'm not formatting it properly in my view code.
I thought I would also, in case it might make a difference, mention that I'm currently using Python 2.7.8, with Django-1.7, and requests-2.4.3 for this application.
I would appreciate anything that you can suggest.
Thanks.
Henry