Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript $.each data()在firefox和chrome上返回不同的结果_Javascript_Jquery_Json - Fatal编程技术网

Javascript $.each data()在firefox和chrome上返回不同的结果

Javascript $.each data()在firefox和chrome上返回不同的结果,javascript,jquery,json,Javascript,Jquery,Json,我收到了一封电子邮件发送的这种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 (chans

我收到了一封电子邮件发送的这种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"
      }
   }
}
{
“媒体”:{
"1369725029":{
“id_profile”:“5738”,
“照片档案”:“http:\/\/www.mupiz.com\/5738\/picture”,
“词组提要”:“一个新的词组”,
“名称媒体”:“La Douleur(chanson sur mon tableau)”,
“nom_profil”:“Kris”,
“url_profile”:“kris”,
“流媒体”:“\r\n La Douleur(chanson sur mon tableau)\r\n”,
“url\U媒体”:“http:\/\/www.mupiz.com\/kris\/la douleur chanson sur mon tab”
},
"1369723360":{
“id_profile”:“5738”,
“照片档案”:“http:\/\/www.mupiz.com\/5738\/picture”,
“词组提要”:“一个新的词组”,
“nom_media”:“Hi Way(chanson)”,
“nom_profil”:“Kris”,
“url_profile”:“kris”,
“流媒体”:“\r\n在高速路上(chanson)\r\n”,
“url\U媒体”:“http:\/\/www.mupiz.com\/kris\/on-the-hi-way-chanson1”
},
"1368389617":{
“id_profile”:“32236”,
“照片档案”:“http:\/\/www.mupiz.com\/32236\/picture”,
“短语提要”:“一个新的视频”,
“nom_media”:“P!nk-给我一个Nate Ruess的理由(真正的Chanty封面)”,
“nom_profil”:“真正的Chanty”,
“url_profile”:“RealChanty”,
“流媒体”:“,
“url\U媒体”:“http:\/\/www.mupiz.com\/RealChanty\/video\/p-nk-just-give-me-a-reason-ft-nate-ruess-real-chanty-cover”
},
"1368384065":{
“id_profile”:“1388”,
“照片档案”:“http:\/\/www.mupiz.com\/1388\/picture”,
“词组提要”:“一个新的词组”,
“nom_media”:“Hi Way(chanson)”,
“nom_profil”:“Fred.Baz1合成器吉他手”,
“url_profile”:“fred bazin”,
“流媒体”:“\r\n在高速路上(chanson)\r\n”,
“url\U媒体”:“http:\/\/www.mupiz.com\/fred bazin\/在hi way chanson上”
}
}
}
Chrome获得“正确”的订单FF没有


有什么想法吗?

我认为你不能依赖于JSON对象中属性的顺序——JSON可以以任何顺序返回

从JSON规范

可能重复?

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

从JSON规范

可能重复?

不,不必因为JS没有维护顺序就订购属性。一般的想法是,因为这些是键值对,所以不需要维护顺序。另一方面,对象数组可以并且将保持顺序,因为它由索引绑定,并且是可迭代的。以下是对象数组的外观:

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

 ]

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

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

 ]

正确设置格式,这样就不需要一条直线上的所有想法来轻松解决问题,时间戳应该是按描述排序的。感谢您正确地对其进行了格式化,这样就不会有任何简单的解决方法,时间戳应该是按描述排序的。ThanksHow我可以用$吗?每个人都可以保留这个订单吗?@user1965147您不能用当前的设置来做这件事。这也不能转换为数组。我想你只能通过他们的名字来访问它,比如:
json.media[“1369725029”]
(如果你想选择json中的第一个对象)我如何使用$。每个人都保持这个顺序?@user1965147你不能用当前的设置这样做。这也不能转换为数组。我想您只需通过他们的名字访问它,比如:
json.media[“1369725029”]
(如果您想选择json中的第一个对象)