简体   繁体   中英

Jackson JSON Processing key name = ognl name

I have a class

When converting from JAVA to JSON i want key name to be ognl name suppose

package com.xx.yy;
public Class A{

private String name;

}

the out put json should be

{
"A.name":"value"
}

This should work:

public Class A {

  @JsonProperty("A.name")
  private String getName() {
    return name;
  }
}

Here is the Javadoc for @JsonProperty .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM