保持在一个JSON列表中元素的顺序? [英] Is the order of elements in a JSON list maintained?

查看:1716
本文介绍了保持在一个JSON列表中元素的顺序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到元素的顺序不是原来的顺序一个JSON对象。

I've noticed the order of elements in a JSON object not being the original order.

什么JSON列表的元素呢?他们是为了维护?

What about the elements of JSON lists? Is their order maintained?

推荐答案

是,元素的JSON数组的顺序是preserved。从 RFC 7159 -The JavaScript对象符号(JSON)数据交换格式
(重点煤矿):

Yes, the order of elements in JSON arrays is preserved. From RFC 7159 -The JavaScript Object Notation (JSON) Data Interchange Format (emphasis mine):

这是对象是一个无序的零个或多个名称/值集合
  对,其中一个名字是一个字符串和一个值是字符串,数字,
  布尔值,null,对象或数组。

An object is an unordered collection of zero or more name/value pairs, where a name is a string and a value is a string, number, boolean, null, object, or array.

数组是一个订购零个或多个值序列。

An array is an ordered sequence of zero or more values.

术语对象和阵列从何而来的约定
  JavaScript的。

The terms "object" and "array" come from the conventions of JavaScript.

这篇关于保持在一个JSON列表中元素的顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆