對於json中含有點號,等其他特殊的,不是規范的java變量名的字符,可以使用一個注解來處理。
貼代碼:
import com.fasterxml.jackson.annotation.JsonProperty; public class Api { private Bean APISSInshopApi; @JsonProperty("API.SSInshopApi") public Bean getAPISSInshopApi() { return APISSInshopApi; } public void setAPISSInshopApi(Bean aPISSInshopApi) { APISSInshopApi = aPISSInshopApi; } }
{"API.SSInshopApi":{"auctions":[{"title":"這裡是title","user_id":"687asd58sadf7576","pict_url":"http://www.baidu.com","quantity":"22"}]}}