小编Sco*_*der的帖子

Jackson Exception when parsing Yaml with a Map of List values

I have a Yaml document that includes map entries that correspond to lists. Here's an example:

environments:
  qa: [ 'us-east-1' ]
  staging: [ 'us-east-1', 'us-west-2' ]
Run Code Online (Sandbox Code Playgroud)

I am using Jackson 2.3.2 to parse the document into a class using the following field & accessors:

private Map<String, List<String>> environments = new HashMap<String, List<String>>();

@JsonProperty
public Map<String, List<String>> getEnvironments() {
    return environments;
}

@JsonProperty
public void setEnvironments(Map<String, List<String>> environments) {
    this.environments = environments;
}
Run Code Online (Sandbox Code Playgroud)

I'm testing the reading of the Yaml file …

java yaml jackson dropwizard

3
推荐指数
1
解决办法
7035
查看次数

标签 统计

dropwizard ×1

jackson ×1

java ×1

yaml ×1