我的问题是我正在将map的内容序列化到JSON.
在输出(JSON)中,我有遵循键/名称语法规则对象.
The key is created from map key, and the name from the value.
Model Example:
class Storage {
Map<String,String> values = new HashMap<>();
{
map.put("key1","key1");
map.put("key2","key2");
map.put("key3","key3");
}
}
JSON示例对象:
{
key1=value1,
key2=value2,
key3=value3
}
JSON模式:
{
"name": "storage",
"description": "Store of key values",
"properties": {
// How can we describe the properties if we do not know the name ?
}
}
The issue is that i do not know what the values will be but i know that they will be some.
你能帮我提供模式的完整定义吗?
Disclaimer:
I know that this can be also serialized as
{
values: [
{key="key1", value="value1"},
{key="key2", value="value2"},
{key="key3", value="value3"}
]
}
但是不希望在JSON中有array.