I have created a JSON object that looks like this at source:
{"34693":"Marko Arnautovic","23122":"Asmir Begovic","39935":"Steven N'Zonzi","4145":"Robert
Huth","3860":"Jonathan Walters","8505":"Glenn Whelan","23446":"Marc Wilson","29762":"Oussama
Assaidi","24148":"Erik Pieters","26013":"Mame Biram Diouf","75177":"Marc Muniesa","38772":"Geoff
Cameron","29798":"Ryan Shawcross","107395":"Jack Butland","3807":"Peter Crouch","8327":"Charlie
Adam","18181":"Phil Bardsley","254558":"Oliver Shenton","130334":"Adnan
Januzaj","4092":"Rafael","18701":"Falcao","10620":"Anders Lindegaard","4564":"Robin van
Persie","25363":"Juan Mata","71174":"Ander Herrera","79554":"David de Gea","71345":"Chris
Smalling","81726":"Phil Jones","118244":"Luke Shaw","137795":"Tyler Blackett","145271":"James
Wilson","2115":"Michael Carrick","3859":"Wayne Rooney","8166":"Ashley Young","5835":"Darren
Fletcher","22079":"Jonny Evans"}
However, when I print this to screen, I get this:
{u'71174': u'Ander Herrera', u'18701': u'Falcao', u'8505': u'Glenn Whelan', u'118244': u'Luke
Shaw', u'254558': u'Oliver Shenton', u'34693': u'Marko Arnautovic', u'3807': u'Peter Crouch',
u'3860': u'Jonathan Walters', u'23122': u'Asmir Begovic', u'75177': u'Marc Muniesa', u'38772':
u'Geoff Cameron', u'39935': u"Steven N'Zonzi", u'8327': u'Charlie Adam', u'23446': u'Marc Wilson',
u'81726': u'Phil Jones', u'4145': u'Robert Huth', u'24148': u'Erik Pieters', u'26013': u'Mame Biram Diouf', u'10620': u'Anders Lindegaard', u'71345': u'Chris Smalling', u'2115': u'Michael Carrick',
u'107395': u'Jack Butland', u'4092': u'Rafael', u'8166': u'Ashley Young', u'18181': u'Phil Bardsley',
u'145271': u'James Wilson', u'4564': u'Robin van Persie', u'130334': u'Adnan Januzaj', u'25363':
u'Juan Mata', u'5835': u'Darren Fletcher', u'3859': u'Wayne Rooney', u'79554': u'David de Gea',
u'29798': u'Ryan Shawcross', u'29762': u'Oussama Assaidi', u'137795': u'Tyler Blackett', u'22079':
u'Jonny Evans'}
The first few entries look like they are sorted in ascending alphabetical order based on the first name, but then the order seems to disintegrate altogether.
Can anyone tell me:
1) Why this is happening? 2) What syntax I need to print to screen in the original order?
In this example it is not too much of an issue if the JSON object is jumbled up, but I am parsing other much bigger items where printing to screen in a random order makes it impossible to follow.
Thanks