【发布时间】:2022-02-01 10:53:04
【问题描述】:
我有一个由 2 或 3 个 json 对象组成的 Json 数组,现在我需要将两个 json 对象组合成单个 json 对象,第一个 json 对象来自一种方法,第二个来自另一种方法,让我用例子来解释
response[
{
"id" : 1,
"name" : "Hi",
"no.of slots" [
{
"Mrng" : 10:30,
"Evening" : 11:20
},
{
"Mrng" : 12:00,
"Evening" : 4:00
}
]
},
{
"email" : "abc@gmail.com",
"address" : "abc district"
"no.of slots" [
{
"Mrng" : 10:30,
"Evening" : 11:20
}
]
}
]
那么我需要像这样的输出
response: {
"id" : 1,
"name" : "Hi",
"no.of slots" [
{
"Mrng" : 10:30,
"Evening" : 11:20
},
{
"Mrng" : 12:00,
"Evening" : 4:00
}
],
"email" : "abc@gmail.com",
"address" : "abc district"
}
没有插槽如果我需要删除重复项或需要合并的唯一项,我们将不胜感激。 提前致谢
【问题讨论】: