Can not deserialize instance of com.entity.StudentDto out of START_ARRAY token
at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@5aa0b86d; line: 1, column: 1]
项目背景:jersey框架,fastjson
com.alibaba
fastjson
1.1.37
1:对于json为String用{}包裹 中存在单个[{}]对象的,单独定义class用List定义接收
2: 存在数组的,定义字段为String[ ]接收;private String[] probeTemperatures;
3:类定义
* @note 接收的json的参数类
* @author alex
* @date 2018年4月19日
*/
@Data
public class VehInfoDto {
private String id;
private String reportDataId;
private String vin;
private String eventId;
private String messageType;
private int sequence;
private String eventDateTimeUTC;
private String createdDate;
private String lastUpdatedDate;
private CompleteVehicle completeVehicle;
private Engine engine;
private FuelCell fuelCell;
private Gps gps;
private LimitValue limitValue;
private Warnings warnings;
private List electricalMachine;//此class必须List
}
ps:今天天气不错,就开心把出问题并解决的json贴出来
{"id":"5a5f0328548e3b6515fd530a","reportDataId":"98038e7a-a93f-4ade-9865-d2ab575485d1","vin":"WL42110","eventId":"3185402899_1516176168337_139_@NGTP","messageType":"REAL_TIME_DATA_REPORTING","sequence":250,"eventDateTimeUTC":"2020-02-23T12:07:23.000+0000","engine":{"state":"ON","crankshaftSpeed":4000,"fuelConsumption":400},"completeVehicle":{"vehicleState":"STARTUP","chargingState":"UNCHARGED","operationMode":"FUEL","vehicleSpeed":110,"accumulatedMilage":1234567,"totalVoltage":1000,"totalCurrent":500,"soc":55,"dcdcState":"STANDBY","gearPosition":{"type":"GEAR_3","drivingForce":false,"brakingForce":false},"insulationResistance":45679},"electricalMachine":[{"sn":1,"state":"DEACTIVATION_STATE","controllerTemperature":25,"speed":0,"torque":0,"temperature":24,"inputVoltage":3000,"controllerDcBusCurrent":10}],"fuelCell":{"voltage":299,"current":2000,"fuelConsumption":1998,"probeTemperatures":[100,101,103],"maxTempInHydrogenSystem":1000,"maxPressureOfHydrogen":500,"maxConcentrationOfHydrogen":34000,"codeOfProbeWithMaxTempInHydrogenSystem":4,"codeOfSensorWithMaxConcentrationOfHydrogen":2,"codeOfSensorWithMaxPressureOfHydrogen":1,"highPreasureDcdcState":"STANDBY"},"gps":{"positioningType":"TRANSFORMED","northLatitude":true,"eastLongitude":true,"transformationType":"THIRD_PARTY","longitude":0.027777777777777776,"latitude":0.027777777777777776},"limitValue":{"idNoOfBatterySubsystemWithMinVoltage":2,"idNoOfBatterySubsystemWithMaxVoltage":1,"idNoOfCellWithMinVoltage":2,"idNoOfCellWithMaxVoltage":4,"idNoOfSubsystemWithMinTemperature":1,"idNoOfSubsystemWithMaxTemperature":1,"codeOfProbeSubsystemWithMinTemperature":2,"codeOfSingleProbeWithMaxTemperature":1,"minTemperature":66,"maxTemperature":60},"warnings":{"highestWarningLevel":"LEVEL_2_FAULT","warnings":[{"faultType":"ELECTRICAL_MACHINE_FAULT","deviceId":2,"faultCode":66,"warningLevel":"LEVEL_2_FAULT","warningMark":"TEMPERATURE_DIFFERENCE"},{"faultType":"ELECTRICAL_MACHINE_FAULT","deviceId":1,"faultCode":66,"warningLevel":"LEVEL_2_FAULT","warningMark":"TEMPERATURE_DIFFERENCE"}]},"createdDate":"2018-01-17T08:02:48.787+0000","lastUpdatedDate":"2018-01-17T08:02:49.072+0000"}