这是在数据提交时遇到的问题。
我准备提交的数据结构是这样的:
{
"path": "test",
"clients": [
{
"client": "1.2.2.2;1.1.1.1",
"Access_Type": 2,
"name": "test_01"
},
{
"client": "1.2.2.4;1.1.1.4",
"Access_Type": 1,
"name": "test_02"
},
{
"client": "1.3.3.3",
"Access_Type": 1,
"name": "test_03"
}
]
}
而需要提交的数据的结构是这样的:
{
"path": "test",
"clients": [
{
"client": "1.2.2.2",
"Access_Type": 2,
"name": "test_01"
},
{
"client": "1.1.1.1",
"Access_Type": 2,
"name": "test_01"
},
{
"client": "1.2.2.4",
"Access_Type": 1,
"name": "test_02"
},
{
"client": "1.1.1.4",
"Access_Type": 1,
"name": "test_02"
},
{
"client": "1.3.3.3",
"Access_Type": 1,
"name": "test_03"
}
]
}
注:client
对应的字段,如果是多条并以“;”分隔,则做拆分处理,单条则不处理。
对于这种JSON数据结构的拆分,大家有什么解决方案,希望指教一下!