Phalanger json_decode problem
2 posts
• Page 1 of 1
Phalanger json_decode problem
I have a php json string as follows:
We then json decode it
$response = json_decode($response, true);
but the resulting array has truncated the key from "1608630144506594e510521"
to "1608630144"
i.e.
- "data" {array(3)} string => array
- 1608630144 {array(8)} integer => array
Any ideas why this would happen? The rest of the decode seems to work ok
Thanks
Ade
- Code: Select all
$response="{\"calls\":[{\"data\":{\"1608630144506594e510521\":{\"message\":\"Hi friend! Please take these servings of Onion Broth with my compliments. I\u2019m sure they\u2019ll go down well on your Ranch!\",\"type\":\"gift\",\"from\":321016942048,\"timestamp\":1348834533,\"title\":\"Kingdom Quest\",\"fbRequestId\":\"416247058424493\",\"sendKey\":\"f337911ac5c8e2e03febac1j4!a5gqYruUpFMGT02jkI0SXRK!634xj971Kkswxx)NUTKkswxxj971Kkswxxj971\",\"data\":{\"action\":\"sendgift\",\"uidFrom\":100003801210309}},\"1284821833506daa2b49b8d\":{\"message\":\"Hey friend! Please help me in Kingdom Quest!\",\"type\":\"help\",\"from\":\"200637653111\",\"timestamp\":1349364267,\"title\":\"Kingdom Quest\",\"fbRequestId\":\"367570213319824\",\"sendKey\":\"de7ed9c56aa99e47b6a1ed0c1783705a$$dcF2Q.UX!*c4!a5g-cqYsq,lFMGT02kfL0P,VK!634xj971Kkswxx)NUTKkswxxj971Kkswxxj971\",\"data\":{\"action\":\"staffing\",\"userIdList\":\"5899859037\",\"userIdFrom\":\"62466565\",\"relatedEntityId\":1000653627,\"relatedTemplateId\":\"common_dragon_nest\"}},\"1967526190507550247a91a\":{\"message\":\"Hey friend! How'd you like to make a fortune with me in Kingdom Quest? Grow crops and animals, harvest ingredients and use them to cook dishes!\",\"type\":\"invite\",\"from\":321016492048,\"timestamp\":1349865508,\"title\":\"Kingdom Quest\",\"fbRequestId\":\"189633911171920\",\"sendKey\":\"996df61944a871e4589e128a6be3558a$$eeG(O,SU)2j4!a5g-cqYtz2e80GKX*egO4TZTS5YckxWF9a5iYyG,hFVOS2YyG,hF9a5iYyG,hF9a5i\",\"data\":{\"action\":\"invite\",\"src\":\"invite\",\"uid\":100000801210309}}}}],\"token\":\"NDAwMTMzYWQ1YTdlMDY0OTlhYjczZTE3MTdmMjUwNWNiY2ZlNjM1ZTRlOTRmMzhmZGRkMzc1ODA0MzJmMWM5Znx1fDIwMDTg3fDEwMDAwMDE5MnwxMzQ5OTY2MDU0fDF8QUFBRFpDejVwTFM2QUJBR2tubGhON1I2NjlIakJ3Y2tjUEs0UjJRcDFrRFFTTVdaQWZONWhYeXJ2Q3JXZzVDOXp3b1B0UTdKSU9aQTFkNU1KclMwakIwZnA4R01RNEo3cE14N2l4T3Fnd1pEWkQ\",\"zid\":\"2000645601187\"}"
We then json decode it
$response = json_decode($response, true);
but the resulting array has truncated the key from "1608630144506594e510521"
to "1608630144"
i.e.
- "data" {array(3)} string => array
- 1608630144 {array(8)} integer => array
Any ideas why this would happen? The rest of the decode seems to work ok
Thanks
Ade
- AdeHall
- Posts: 1
- Joined: October 11th, 2012, 11:28 am
Re: Phalanger json_decode problem
Thanks for reporting this behaviour. Phalanger is trying to convert key to number ... but as you see, this conversion is not correct. This will be fixed.
This affects also simple array access operations.
This affects also simple array access operations.
- Code: Select all
var_dump( array("1608630144506594e510521" => 0) );
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 2 guests