JSON parse error: Cannot deserialize value of type java.util.ArrayList<com.tzy.entity.ComponentOilProperties> from Object value (token JsonToken.START_OBJECT); nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type java.util.ArrayList<com.tzy.entity.ComponentOilProperties> from Object value (token JsonToken.START_OBJECT) at [Source: (org.springframework.util.StreamUtils$NonClosingInputStream); line: 1, column: 1]] 前端以Json格式传递列表时的书写格式错误及解决方案
报错
JSON parse error: Cannot deserialize value of type java.util.ArrayList<com.tzy.entity.ComponentOilProperties>
from Object value (token JsonToken.START_OBJECT
); nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type java.util.ArrayList<com.tzy.entity.ComponentOilProperties>
from Object value (token JsonToken.START_OBJECT
) at [Source: (org.springframework.util.StreamUtils$NonClosingInputStream); line: 1, column: 1]]文章来源:https://www.toymoban.com/news/detail-507708.html
解决方案
报错的写法
{
"setSettings":
[
{
"name": "chongZheng",
"xinwan": 100,
"liu": 0,
"ben": 0.6,
"xiting": 0,
"midu": 0.8
},
{
"name": "mtbe",
"xinwan": 116.66,
"ben": 3,
"liu": 0,
"xiting": 0,
"midu" : 0.73
},
{
"name": "feiFang",
"xinwan": 74.34,
"liu": 0,
"ben": 0.8,
"xiting": 7,
"midu": 0.67
}
]
}
正确写法
[
{
"name": "chongZheng",
"xinwan": 100,
"liu": 0,
"ben": 0.6,
"xiting": 0,
"midu": 0.8
},
{
"name": "mtbe",
"xinwan": 116.66,
"ben": 3,
"liu": 0,
"xiting": 0,
"midu" : 0.73
},
{
"name": "feiFang",
"xinwan": 74.34,
"liu": 0,
"ben": 0.8,
"xiting": 7,
"midu": 0.67
}
]
不需要写后端接收List的名称文章来源地址https://www.toymoban.com/news/detail-507708.html
到了这里,关于前端以Json格式传递列表时的书写格式错误及解决方案的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!