这个Json怎么写才正确
How to write this Json properly
我正在写一个Json api,输入是这样的。如何在 json 中正确输入?
输入为 Json in Strapi API
Category 1:
{
Name : x
Price: y
Url: z
}
{
Name : a
Price: b
Url: c
}
{
Name : d
Price: e
Url: f
}
Category 2:
Another array
映射中仍有问题:
still have the issue Warning: Encountered two children with the same key, `1`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.
以下结构适合您的用例:
{
"categories": {
"Category 1": [
{
"Name": "x",
"Price": "y",
"Url": "z"
},
{
"Name": "a",
"Price": "b",
"Url": "c"
},
{
"Name": "d",
"Price": "e",
"Url": "f"
}
],
"Category 2": [
{
"Name": "x",
"Price": "y",
"Url": "z"
},
{
"Name": "a",
"Price": "b",
"Url": "c"
},
{
"Name": "d",
"Price": "e",
"Url": "f"
}
]
}
}
我正在写一个Json api,输入是这样的。如何在 json 中正确输入? 输入为 Json in Strapi API
Category 1:
{
Name : x
Price: y
Url: z
}
{
Name : a
Price: b
Url: c
}
{
Name : d
Price: e
Url: f
}
Category 2:
Another array
映射中仍有问题:
still have the issue Warning: Encountered two children with the same key, `1`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.
以下结构适合您的用例:
{
"categories": {
"Category 1": [
{
"Name": "x",
"Price": "y",
"Url": "z"
},
{
"Name": "a",
"Price": "b",
"Url": "c"
},
{
"Name": "d",
"Price": "e",
"Url": "f"
}
],
"Category 2": [
{
"Name": "x",
"Price": "y",
"Url": "z"
},
{
"Name": "a",
"Price": "b",
"Url": "c"
},
{
"Name": "d",
"Price": "e",
"Url": "f"
}
]
}
}