我正在尝试格式化要在Eloquent
Highmaps
查询的输出
我的代码:
$regsByCtry = $regsByCtryArr->pluck('ctry', 'val')->map(function($country, $value) {
return [
"hc-key" => $country,
"value" => $value
];
})->toJson();
输出:
"{
"1": {"hc-key":"br","value":1},
"5": {"hc-key":"au","value":5}
}"
我正在尝试输出没有键的JSON,作为对象的集合:
"{
{"hc-key":"br","value":1},
{"hc-key":"au","value":5}
}"
感谢您的帮助。
答案 0 :(得分:0)
使用值链式方法
node_modules