Java Unexpected character (‘-‘(code x)) in numeric value:expected digit (x) to follow minus sign问题解决

问题描述:

org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Unexpected character ('-' (code 45)) in numeric value: expected digit (0-9) to follow minus sign, for valid numeric value;

nested exception is com.fasterxml.jackson.core.JsonParseException: Unexpected character ('-' (code 45)) in numeric value: expected digit (0-9) to follow minus sign, for valid numeric value
 at [Source: (PushbackInputStream); line: 1, column: 3]

问题分析:

1、使用PostMan调试后端Post接口时,请求体使用form-data方式传参,导致报错。

 解决办法:

使用raw方式传参。