【发布时间】:2018-10-31 02:35:59
【问题描述】:
什么是最好的转换方式:
["Isolated-1", "SVT_FedPortGroup", "SVT_StoragePortGroup", "VM Network", "test-pg-2002"]
还有这个:
["target_Isolated-1", "target_SVT_FedPortGroup", "target_SVT_StoragePortGroup","target_VM Network" ,"target_test-pg-2002"];
到:
"NetworkMaps": [
{
"ENVID": null,
"SourcePG": "Isolated-1",
"TargetPG": "target_Isolated-1"
},
{
"ENVID": null,
"SourcePG": "VM Network",
"TargetPG": "target_SVT_FedPortGroup"
}...
]
我需要将两个数组与各自的值合并。 例如
arr1 : ["a", "b", "c"];
arr2 : ["apple", "ball", "cat"];
result : [{source: "a",target: "apple"}, {source: "b",target: "ball"},{source: "c",target: "cat"}]
【问题讨论】:
-
提供你迄今为止所做的努力?
-
有很多资源可以做到这一点..请谷歌它..
-
为什么
VM Network和target_SVT_FedPortGroup是同一个组?到目前为止你做了什么? -
@Eddie VM Network 与 target_SVT_FedPortGroup 是同一组,因为键值。 [3] -> [3]
标签: javascript arrays angularjs json