有从数据库中检索的模式,我需要转换为 json 模式,谁能告诉我如何在 java 或 mule 中做到这一点。
下面是我的代码:
{"Schema": [
{
"Column_Name": "Employee Name",
"Type": "varchar",
"SafeType": "string",
"Length": 51,
"Description": null
},
{
"Column_Name": "Username",
"Type": "varchar",
"SafeType": "string",
"Length": 51
}
]}
Output should be:
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/root.json",
"type": "object",
"title": "The Root Schema",
"properties": {
"Employee Name": {
"$id": "#/properties/Employee Name",
"type": "varchar",
"maxLength":50
},
"Username": {
"$id": "#/properties/Username",
"type": "string",
"maxLength":50
}
}
}
Please guide