阵列采用以下格式。我尝试了一些方法,但我找不到合适的方法。
我想通过AJAX调用发送以下JSON,但我不想在两个子数组中都使用密钥0,1。
[scheduleDetails] => Array
(
[2] => Array
(
[Wednesday] => Array
(
[0] => Array
(
[startTime] => Array
(
[0] => 00:00
[1] => 12:00
)
)
[1] => Array
(
[endTime] => Array
(
[0] => 12:00
[1] => 07:40
)
)
)
)
)
我想要像
这样的东西 [scheduleDetails] => Array
(
[Wednesday] => Array
(
[startTime] => Array
(
[0] => 00:00
[1] => 12:00
)
[endTime] => Array
(
[0] => 12:00
[1] => 07:40
)
)
)
最好的方法是什么 或者在jquery中
"scheduleDetails":[
{"Friday":[{"startTime":["09:00","15:00"]},{"endTime":["13:00","21:00"]}]}],
像
"scheduleDetails":[
"Friday":["startTime":["09:00","15:00"]},{"endTime":["13:00","21:00"]]],
答案 0 :(得分:0)
"scheduleDetails":[
"Friday":[{"startTime":["09:00","15:00"]},{"endTime":["13:00","21:00"]}]],
注意打开和关闭阵列。
[,] -> array object
{}-> object