Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.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
flatter:json.decode更改元素的顺序_Json_Flutter_Decode - Fatal编程技术网

flatter:json.decode更改元素的顺序

flatter:json.decode更改元素的顺序,json,flutter,decode,Json,Flutter,Decode,我从http请求中获取此json字符串: {"163":[{"year":"2018","downloads":253}],"162":[{"year":"2018","downloads":525}]} 在json.decode之后,我的地图如下所示: {162: [{year: 2018, downloads: 525}], 163: [{year: 2018, downloads: 253}]} 如何在地图中保持排序顺序 thx地图的顺序无关紧要。您可以通过调用map['163'] 此

我从http请求中获取此json字符串:

{"163":[{"year":"2018","downloads":253}],"162":[{"year":"2018","downloads":525}]}
在json.decode之后,我的地图如下所示:

{162: [{year: 2018, downloads: 525}], 163: [{year: 2018, downloads: 253}]}
如何在地图中保持排序顺序


thx

地图的顺序无关紧要。您可以通过调用
map['163']

此外,我建议以有效的方式命名json属性,以便其他编程语言可以将json反序列化为类。在您的例子中,163在几乎所有编程语言中都是无效的变量/属性namy