0

我收到了一个发送的这种 json

{
   "media":{
      "1369725029":{
         "id_profil":"5738",
         "photo_profil":"http:\/\/www.mupiz.com\/5738\/picture",
         "phrase_feed":"a ajout\u00e9 une nouvelle chanson",
         "nom_media":"La Douleur (chanson sur mon tableau)",
         "nom_profil":"KRISS",
         "url_profil":"kriss",
         "streaming":"\r\n  <div class=\"playerMedia\" onclick=\"InlinePlayer(this)\" data-url=\"http:\/\/www.mupiz.com\/mp3\/5738\/mp3_51550.mp3\" data-id=\"mp3_51550.mp3\">La Douleur (chanson sur mon tableau)<\/div>\r\n",
         "url_media":"http:\/\/www.mupiz.com\/kriss\/la-douleur-chanson-sur-mon-tab"
      },
      "1369723360":{
         "id_profil":"5738",
         "photo_profil":"http:\/\/www.mupiz.com\/5738\/picture",
         "phrase_feed":"a ajout\u00e9 une nouvelle chanson",
         "nom_media":"On the Hi-Way (chanson)",
         "nom_profil":"KRISS",
         "url_profil":"kriss",
         "streaming":"\r\n  <div class=\"playerMedia\" onclick=\"InlinePlayer(this)\" data-url=\"http:\/\/www.mupiz.com\/mp3\/5738\/mp3_54344.mp3\" data-id=\"mp3_54344.mp3\">On the Hi-Way (chanson)<\/div>\r\n",
         "url_media":"http:\/\/www.mupiz.com\/kriss\/on-the-hi-way-chanson1"
      },
      "1368389617":{
         "id_profil":"32236",
         "photo_profil":"http:\/\/www.mupiz.com\/32236\/picture",
         "phrase_feed":"a ajout\u00e9 une nouvelle vid\u00e9o",
         "nom_media":"P!nk - Just Give Me A Reason ft Nate Ruess (Real Chanty Cover) ",
         "nom_profil":"Real Chanty",
         "url_profil":"RealChanty",
         "streaming":"<iframe width=\"270px\" height=\"200px\" src=\"http:\/\/www.youtube.com\/embed\/xiDzmc59fjg\" frameborder=\"0\" allowfullscreen><\/iframe>",
         "url_media":"http:\/\/www.mupiz.com\/RealChanty\/video\/p-nk-just-give-me-a-reason-ft-nate-ruess-real-chanty-cover"
      },
      "1368384065":{
         "id_profil":"1388",
         "photo_profil":"http:\/\/www.mupiz.com\/1388\/picture",
         "phrase_feed":"a ajout\u00e9 une nouvelle chanson",
         "nom_media":"On the Hi-Way (chanson)",
         "nom_profil":"Fred.Baz1-Compositeur-Bassiste-Guitariste",
         "url_profil":"fred-bazin",
         "streaming":"\r\n  <div class=\"playerMedia\" onclick=\"InlinePlayer(this)\" data-url=\"http:\/\/www.mupiz.com\/mp3\/1388\/mp3_49786.mp3\" data-id=\"mp3_49786.mp3\">On the Hi-Way (chanson)<\/div>\r\n",
         "url_media":"http:\/\/www.mupiz.com\/fred-bazin\/on-the-hi-way-chanson"
      }
   }
}

Chrome 得到“正确”的命令 FF 没有,

有任何想法吗 ?

4

2 回答 2

5

我认为您不能依赖 JSON 对象中属性的顺序 - JSON 可以按任何顺序返回。

来自http://www.json.org/的 JSON 规范

An object is an unordered set of name/value pairs

可能重复? JSON 顺序混淆

于 2013-05-30T02:04:02.033 回答
1

不,仅仅因为 JS 不维护顺序,属性就不需要按顺序排列。一般的想法是,由于这些是键值对,因此不需要维护顺序。另一方面,对象数组可以并且将保持顺序,因为它由索引绑定并且是可迭代的。这是对象数组的样子:

[
     { "name" : "test", "age" : 10 }, //index 0
     { "name" : "test1" ,"age": 15 } //index 1

 ]
于 2013-05-30T02:07:43.393 回答