FasterXML / FasterXML/jackson-dataformats-text
Cannot deserialize YAML sets
- 主要言語
- Java
- スター
- 455
- フォーク
- 164
- 平均マージ
- 6日 10時間
- マージ済み PR(30日)
- 2
説明
I was trying to deserialize a mapping of strings to sets and was met with the following error:
```
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `java.util.HashSet` from Object value (token `JsonToken.START_OBJECT`)
at [Source: (BufferedReader); line: 2, column: 4] (through reference chain: java.util.LinkedHashMap["A"])
```
YAML source:
```yaml
# block-style mapping (=set)
A: !!set
? A:A
? A:B
# flow mapping (=set)
B: !!set {B:A:, B:B:}
```
Simplified test code:
```java
public Map> readConfig(Path path) throws IOException {
var yamlMapper = new ObjectMapper(new YAMLFactory());
try (var reader = Files.newBufferedReader(path)) {
return yamlMapper.readValue(reader, new TypeReference<>() {});
}
}
```
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
評価
この issue はまだ評価されていません。