我从多复选框接收以下格式的数据
["Ethnicity"]=>
array(3) {
["Maori"]=>
string(5) "Maori"
["Pacific Peoples"]=>
string(15) "Pacific Peoples"
["Other European"]=>
string(14) "Other European"
}
我正在尝试通过API调用使用以下片段将其放入Jira中的多复选框中
'customfield_11337' => [
"value" => $data["Ethnicity"]
],
但这返回一个错误string(21) "data was not an array"
因此,我尝试使用将数据按摩到单个阵列中
$ethnicityArray = array();
foreach ($data["Ethnicity"] as $eth => $value) {
array_push($ethnicityArray, $value);
}
但这会返回相同的错误。我应该注意到,通过相同的方法在Jira中填充单选按钮、文本字段等没有问题。这似乎只是我搞不清楚的复选框。
我该如何使用PHP来解决这个问题?
正确的解决方案是将数据转换为如下格式:
'customfield_11333' => [["value" => "Asian"], ["value" => "Other"]]