JSON?parse?error:?Cannot?deserialize?value?of?type?`java.util.ArrayList<java.lang.Long>`?from?Object?value?(token?`JsonToken.START_OBJECT`);?nested?exception?is?com.fasterxml.jackson.databind.exc.MismatchedInputException:?Cannot?deserialize?value?of?type?`java.util.ArrayList<java.lang.Long>`?from?Object?value?(token?`JsonToken.START_OBJECT`)\n?at?[Source:?(org.springframework.util.StreamUtils$NonClosingInputStream);?line:?1,?column:?1]
接口:
public AjaxResult editList( String unit, String ruleValue, @RequestBody List<Long> ids){}
第一次寫后端接口 前端傳過來三個(gè)參數(shù), 其中一個(gè)參數(shù)類型為id組成的數(shù)組, 后端對(duì)這個(gè)ID數(shù)組的類型設(shè)置成List<Long>類型, 請(qǐng)求接口報(bào)上面的錯(cuò)誤,后來給ids前面加了個(gè)@RequestBody注解 再次請(qǐng)求又報(bào)下面這個(gè)錯(cuò):
Uncaught (in promise) Error: Required request parameter 'ruleIds' for method parameter type List is not present文章來源:http://www.zghlxwxcb.cn/news/detail-698599.html
最后無奈改了前端的請(qǐng)求接口:文章來源地址http://www.zghlxwxcb.cn/news/detail-698599.html
export function updateList(data) {
? return request({
? ? url: `/aaa/list?unit=${data.name}&ruleValue=${data.value}`,
? ? method: 'put',
? ? data: data.ids
? })
}
到了這里,關(guān)于JSON parse error: Cannot deserialize value of type `java.util.ArrayList<java.lang.Long>` from Object的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!