我有一个从API获取的对象数组数组。我想将键值对的键显示为表的标题/列名称。当前,标题以任何随机顺序出现。
但我想先显示orderArray中提到的字段,然后再显示其余标题。
我已经按照想要的顺序创建了一个列名数组
[destination_country_name, destination_country_id , primary_cost]
其余数据可以按任何顺序排列
var x = [
{
"destination_country_id":null,
"primary_cost":"9.50",
"region_id":null,
"destination_country_name":"Everywhere Else",
"name" : "xyz",
"place":"abc"
},
{
"destination_country_id":105,
"primary_cost":"8.00",
"region_id":null,
"destination_country_name":"United Kingdom",
"name" : "xyz1",
"place":"abc1"
},
{
"destination_country_id":209,
"primary_cost":"9.50",
"region_id":null,
"destination_country_name":"United States",
"name" : "xyz2",
"place":"abc2"
},
{
"destination_country_id":123,
"primary_cost":"5.00",
"region_id":null,
"destination_country_name":"Ireland",
"name" : "xyz3",
"place":"abc3"
}
]
Run Code Online (Sandbox Code Playgroud)
具有列名的表(仅按以下顺序):
destination_country_name |destination_country_id |primary_cost
我的系统上安装了 ruby 版本 2.1.5。
在运行 bundle install 时,我收到“无法加载 OpenSSL。您必须使用 OpenSSL 支持重新编译 Ruby 或将 Gemfile 中的源从“https”更改为“http”。有关使用 RVM 使用 OpenSSL 进行编译的说明可在 http:/ /rvm.io/packages/openssl。”
我的 Gemfile 只有 http 有酸味。
在执行“rvm pkg install openssl”时:==> 公式 curl-openssl glib-openssl openssl@1.1 ?自制软件/便携式红宝石/便携式openssl
没有 openssl@1.0 和 openssl
如何从 1.0 降级到 openssl@1.0。
已经试过 rvm restart 2.1.5 --with-openssl-dir=brew --prefix openssl@1.0
但是对我没用。