【发布时间】:2018-11-16 18:54:47
【问题描述】:
我从 Json 架构(属性)中提取字段,但字段不是按照架构顺序。
代码:- JSON Schema 文件-
{
"type": "object",
"required": [ "title", "description" ],
"properties": {
"title": { "type": "string" },
"description": { "type": "string" },
"termsOfServiceUrl": { "type": "string", "format": "uri" },
"contact": { "type": "integer", "format": "email" },
"license": { "type": "string" },
"licenseUrl": { "type": "string", "format": "uri" }
},
"additionalProperties": false
}
val schemafileparse = parse(schemafile)
val column_list = (schemafileparse \"properties").camelizeKeys.extract[Map[String,Any]].keySet
结果:-
Set(termsOfServiceUrl, description, contact, license, title, licenseUrl)
预期结果:-
Set(title, description, termsOfServiceUrl, contact, license, licenseUrl)
我怎样才能得到预期的结果。我会根据 json config schema 单独获取数据文件。
【问题讨论】: