-1
我正在開發iPhone應用程序。在這裏,我嘗試後我用下面的代碼數據:將數據發佈爲JSON格式
NSDictionary *contactData = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:score] ,@"score",
[NSNumber numberWithInt:game_id] ,@"game_id",
game_version ,@"game_version",
platform ,@"platform",
[NSNumber numberWithInt:timestamp] ,@"timestamp",
[NSNumber numberWithInt:elapsed_time] ,@"elapsed_time",
hash ,@"hash",
[NSNumber numberWithInt:level_reached] ,@"level_reached",
verification ,@"verification",
nil];
[request1 addPostValue:contactData forKey:@"plays[]"];
我想生成以下格式:
Array
(
[plays] => Array
(
[0] => Array
(
[score] = 513956
[game_id] = 1
[game_version] = 1.0
[platform] = Web
[timestamp] = 1313146039
[elapsed_time] = 400
[hash] = 61e51000143566bfddjfhdeur88cb7b2ad
[level_reached] = 5
[verification] = e56a35341c7854dref82ad678cb11593
)
)
[module] => play
[action] => save
)
如何可以實現的,我必須做出改變或者我在做錯誤。 請幫幫我。我被困在那。
這不是有效的JSON。 – 2011-08-16 06:14:13
這不是JSON,這是PHP的'print_r'輸出。 – jtbandes
請幫助我如何將其轉換爲有效的JSON? –