json 转数组

-------------syncinfo-----------------
json-----------------
{
"BaseResponse": {
"Ret": 0,
"ErrMsg": ""
}
,
"AddMsgCount": 2,
"AddMsgList": [{
"MsgId": "1664458959297513240",
"FromUserName": "@@654619ba66112d5c28eadf6f951a0ba2ebfa88f7da0ed15fc1a722aa8896b9bf",
"ToUserName": "@190a963ab4c53016ca188d975ec1c84c4248703ccafbe75943b3800053cff290",
"MsgType": 1,
"Content": "@b553606ac35530a5d99d3372fb89a8e4aa161f28ea6ac3c55e539f7473ce6eb0:<br/>6666",
"Status": 3,
"ImgStatus": 1,
"CreateTime": 1454568489,
"VoiceLength": 0,
"PlayLength": 0,
"FileName": "",
"FileSize": "",
"MediaId": "",
"Url": "",
"AppMsgType": 0,
"StatusNotifyCode": 0,
"StatusNotifyUserName": "",
"RecommendInfo": {
"UserName": "",
"NickName": "",
"QQNum": 0,
"Province": "",
"City": "",
"Content": "",
"Signature": "",
"Alias": "",
"Scene": 0,
"VerifyFlag": 0,
"AttrStatus": 0,
"Sex": 0,
"Ticket": "",
"OpCode": 0
}
,
"ForwardFlag": 0,
"AppInfo": {
"AppID": "",
"Type": 0
}
,
"HasProductId": 0,
"Ticket": "",
"ImgHeight": 0,
"ImgWidth": 0,
"SubMsgType": 0,
"NewMsgId": 1664458959297513240
}
,{
"MsgId": "1454547856",
"FromUserName": "newsapp",
"ToUserName": "@190a963ab4c53016ca188d975ec1c84c4248703ccafbe75943b3800053cff290",
"MsgType": 1,
"Content": "<mmreader><category type="20" count="4"><name><![CDATA[腾讯新闻]]></name><br/><topnew><br/><cover><![CDATA[http://inews.gtimg.com/newsapp_ls/0/11273928_small/0]]></cover>Status": 3,
"ImgStatus": 1,
"CreateTime": 1454568430,
"VoiceLength": 0,
"PlayLength": 0,
"FileName": "",
"FileSize": "",
"MediaId": "",
"Url": "",
"AppMsgType": 0,
"StatusNotifyCode": 0,
"StatusNotifyUserName": "",
"RecommendInfo": {
"UserName": "",
"NickName": "",
"QQNum": 0,
"Province": "",
"City": "",
"Content": "",
"Signature": "",
"Alias": "",
"Scene": 0,
"VerifyFlag": 0,
"AttrStatus": 0,
"Sex": 0,
"Ticket": "",
"OpCode": 0
}
,
"ForwardFlag": 0,
"AppInfo": {
"AppID": "",
"Type": 0
}
,
"HasProductId": 0,
"Ticket": "",
"ImgHeight": 0,
"ImgWidth": 0,
"SubMsgType": 0,
"NewMsgId": 1454547856
}
],
"ModContactCount": 0,
"ModContactList": [],
"DelContactCount": 0,
"DelContactList": [],
"ModChatRoomMemberCount": 0,
"ModChatRoomMemberList": [],
"Profile": {
"BitFlag": 0,
"UserName": {
"Buff": ""
}
,
"NickName": {
"Buff": ""
}
,
"BindUin": 0,
"BindEmail": {
"Buff": ""
}
,
"BindMobile": {
"Buff": ""
}
,
"Status": 0,
"Sex": 0,
"PersonalCard": 0,
"Alias": "",
"HeadImgUpdateFlag": 0,
"HeadImgUrl": "",
"Signature": ""
}
,
"ContinueFlag": 0,
"SyncKey": {
"Count": 7,
"List": [{
"Key": 1,
"Val": 647234082
}
,{
"Key": 2,
"Val": 647234681
}
,{
"Key": 3,
"Val": 647234544
}
,{
"Key": 11,
"Val": 647233921
}
,{
"Key": 13,
"Val": 647230079
}
,{
"Key": 201,
"Val": 1454568489
}
,{
"Key": 1000,
"Val": 1454549956
}
]
}
,
"SKey": ""
}
$VAR1 = {
### 每个元素是一个引用
          'AddMsgList' => [
                            {
                              'AppMsgType' => 0,
                              'ImgWidth' => 0,
                              'RecommendInfo' => {
                                                   'NickName' => '',
                                                   'Ticket' => '',
                                                   'Scene' => 0,
                                                   'Sex' => 0,
                                                   'VerifyFlag' => 0,
                                                   'City' => '',
                                                   'OpCode' => 0,
                                                   'UserName' => '',
                                                   'Alias' => '',
                                                   'AttrStatus' => 0,
                                                   'Signature' => '',
                                                   'Province' => '',
                                                   'QQNum' => 0,
                                                   'Content' => ''
                                                 },
                              'Status' => 3,
                              'MediaId' => '',
                              'PlayLength' => 0,
                              'ImgHeight' => 0,
                              'MsgType' => 1,
                              'FromUserName' => '@@654619ba66112d5c28eadf6f951a0ba2ebfa88f7da0ed15fc1a722aa8896b9bf',
                              'FileSize' => '',
                              'Ticket' => '',
                              'ToUserName' => '@190a963ab4c53016ca188d975ec1c84c4248703ccafbe75943b3800053cff290',
                              'StatusNotifyCode' => 0,
                              'ForwardFlag' => 0,
                              'CreateTime' => 1454568489,
                              'ImgStatus' => 1,
                              'NewMsgId' => '1664458959297513240',
                              'StatusNotifyUserName' => '',
                              'FileName' => '',
                              'SubMsgType' => 0,
                              'HasProductId' => 0,
                              'Content' => '@b553606ac35530a5d99d3372fb89a8e4aa161f28ea6ac3c55e539f7473ce6eb0:<br/>6666',
                              'Url' => '',
                              'AppInfo' => {
                                             'Type' => 0,
                                             'AppID' => ''
                                           },
                              'MsgId' => '1664458959297513240',
                              'VoiceLength' => 0
                            },
                            {
                              'AppMsgType' => 0,
                              'ImgWidth' => 0,
                              'RecommendInfo' => {
                                                   'NickName' => '',
                                                   'Ticket' => '',
                                                   'Scene' => 0,
                                                   'Sex' => 0,
                                                   'VerifyFlag' => 0,
                                                   'City' => '',
                                                   'OpCode' => 0,
                                                   'UserName' => '',
                                                   'Alias' => '',
                                                   'AttrStatus' => 0,
                                                   'Signature' => '',
                                                   'Province' => '',
                                                   'QQNum' => 0,
                                                   'Content' => ''
                                                 },
                              'Status' => 3,
                              'MediaId' => '',
                              'PlayLength' => 0,
                              'ImgHeight' => 0,
                              'MsgType' => 1,
                              'FromUserName' => 'newsapp',
                              'FileSize' => '',
                              'Ticket' => '',
                              'ToUserName' => '@190a963ab4c53016ca188d975ec1c84c4248703ccafbe75943b3800053cff290',
                              'StatusNotifyCode' => 0,
                              'ForwardFlag' => 0,
                              'CreateTime' => 1454568430,
                              'ImgStatus' => 1,
                              'NewMsgId' => 1454547856,
                              'StatusNotifyUserName' => '',
                              'FileName' => '',
                              'SubMsgType' => 0,
                              'HasProductId' => 0,
                              'Content' => "<mmreader><category type="20" 
                              'Url' => '',
                              'AppInfo' => {
                                             'Type' => 0,
                                             'AppID' => ''
                                           },
                              'MsgId' => '1454547856',
                              'VoiceLength' => 0
                            }
                          ],
          'AddMsgCount' => 2,
          'Profile' => {
                         'HeadImgUrl' => '',
                         'NickName' => {
                                         'Buff' => ''
                                       },
                         'Status' => 0,
                         'Sex' => 0,
                         'BindEmail' => {
                                          'Buff' => ''
                                        },
                         'Alias' => '',
                         'PersonalCard' => 0,
                         'UserName' => {
                                         'Buff' => ''
                                       },
                         'Signature' => '',
                         'BindUin' => 0,
                         'HeadImgUpdateFlag' => 0,
                         'BitFlag' => 0,
                         'BindMobile' => {
                                           'Buff' => ''
                                         }
                       },
          'BaseResponse' => {
                              'ErrMsg' => '',
                              'Ret' => 0
                            },
          'DelContactList' => [],
          'DelContactCount' => 0,
          'ModContactCount' => 0,
          'ModChatRoomMemberCount' => 0,
          'ContinueFlag' => 0,
          'SKey' => '',
          'ModChatRoomMemberList' => [],
          'SyncKey' => {
                         'List' => [
                                     {
                                       'Val' => 647234082,
                                       'Key' => 1
                                     },
                                     {
                                       'Val' => 647234681,
                                       'Key' => 2
                                     },
                                     {
                                       'Val' => 647234544,
                                       'Key' => 3
                                     },
                                     {
                                       'Val' => 647233921,
                                       'Key' => 11
                                     },
                                     {
                                       'Val' => 647230079,
                                       'Key' => 13
                                     },
                                     {
                                       'Val' => 1454568489,
                                       'Key' => 201
                                     },
                                     {
                                       'Val' => 1454549956,
                                       'Key' => 1000
                                     }
                                   ],
                         'Count' => 7
                       },
          'ModContactList' => []
        };

json-----------------

原文地址:https://www.cnblogs.com/hzcya1995/p/13351028.html