0
在實施過程中YAML以JSON轉換器,我面臨的問題昂首闊步模式:反序列化建設者YAML到JSON轉換
var deserializer = new DeserializerBuilder().Build()
無法識別「整數」,「布爾」類型的默認設置。解串器將這些類型轉換爲字符串。對於例如:我有YAML:
EntityId:
type: integer
example: 1245
EntityIds:
type: array
items:
$ref: EntityId
example: [152, 6542, 23]
轉換的結果是:
"EntityId":{
"type":"integer",
"example":"1245"
},
"EntityIds":{
"type":"array",
"items":{
"$ref":"EntityId"
},
"example":[ "152","6542","23"]
}
,但如果我把輸入YAML任何在線轉換器我得到正確的JSON結果:
"EntityId": {
"type": "integer",
"example": 1245
},
"EntityIds": {
"type": "array",
"items": {
"$ref": "EntityId"
},
"example": [
152,
6542,
23
]
}
也是布爾類型的行爲。
問題是如何設置正確轉換的解串器。
你有ETA嗎? –