티스토리 뷰

728x90
반응형

 

 

자바에서 JSON API 호출 시 나는 에러

 

Non-standard token 'NaN': enable JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS to allow

위와 같은 에러 해결에는 mapper.enable ALLOW_NON_NUMERIC_NUMBERS 추가

 ObjectMapper mapper = new ObjectMapper();
mapper.enable(JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS.mappedFeature());

 

 

Cannot deserialize value of type `java.util.ArrayList<java.lang.Object>` from Object value (token `JsonToken.START_OBJECT`)

Object 타입 에러에는 configure ACCEPT_SINGLE_VALUE_AS_ARRAY 추가!

ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
728x90
반응형
댓글