FasterXML / FasterXML/jackson-dataformats-text

Cannot deserialize YAML sets

オープン
#317 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
yaml
主要言語
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 はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。