Search code examples
djangogoogle-analytics-api

core reporting Api returns JSON + django


I am querying the core reporting api to get unique visitors.

It returns a Json object that looks like this

{u'kind': u'analytics#gaData', u'rows': [[u'11', u'2011', u'New Visitor', u'24961'],...

what is the u that is in the prefix and how can i get rid of it.

Further when i do a console.log on the json object it outputs

{& # 3 9 ;raw& # 3 9;: {u & # 3 9 ;kind & # 3 9;: u & # 3 9;analytics#gaData', u'rows': [[u'11',... (Added space to show that its printing the ascii value)

Any insights?


Solution

  • u means it is in unicode format.

    since most django use unicode. you can convert it into strings by str() method