Can not deserialize instance of

Regular Visitor

Can not deserialize instance of

Sample codes not working for card services.   Issue seems to be with JSON Arrays being passed into the Java Classes for conversion.   All tests end up failing in the sample codes for Card Services API:


"com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of out of START_ARRAY token
at [Source: {"cardholderLowBalanceAmount": {"amount": 0, "currencyCode": "840"}, "pushID": "test", "subscriptions": [{"notificationID": "LowBalance_Email", "isSubscribed": true}, {"notificationID": "ChangeOfCardStatus_Text", "isSubscribed": true}, {"notificationID": "DailyAvailableBalance_PushNotification", "isSubscribed": true}}; line: 1, column: 105] (through reference chain:["subscriptions"])

at com.fasterxml.jackson.databind.JsonMappingException.from(
at com.fasterxml.jackson.databind.DeserializationContext.reportMappingException(
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromArray(
at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeOther(
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(
at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(
at com.fasterxml.jackson.databind.ObjectMapper.readValue(
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(
at java.base/java.lang.reflect.Method.invoke(
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(
at org.junit.runners.model.FrameworkMethod.invokeExplosively(
at org.junit.internal.runners.statements.InvokeMethod.evaluate(
at org.junit.runners.ParentRunner.runLeaf(
at org.junit.runners.BlockJUnit4ClassRunner.runChild(
at org.junit.runners.BlockJUnit4ClassRunner.runChild(
at org.junit.runners.ParentRunner$
at org.junit.runners.ParentRunner$1.schedule(
at org.junit.runners.ParentRunner.runChildren(
at org.junit.runners.ParentRunner.access$000(
at org.junit.runners.ParentRunner$2.evaluate(
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(
at com.intellij.rt.execution.junit.JUnitStarter.main(


Regular Visitor

Re: Can not deserialize instance of

this is for the Java code sample of the Card Services API.





public void putnotificationSubscriptionsTest() throws IOException {

 String jsonPayload = transformPayload("{\"cardholderLowBalanceAmount\": {\"amount\": 0, \"currencyCode\": \"840\"}, \"pushID\": \"test\", \"subscriptions\": [{\"notificationID\": \"LowBalance_Email\", \"isSubscribed\": true}, {\"notificationID\": \"ChangeOfCardStatus_Text\", \"isSubscribed\": true}, {\"notificationID\": \"DailyAvailableBalance_PushNotification\", \"isSubscribed\": true}]}");

ObjectMapper mapper = new ObjectMapper();
NotificationSubscriptionsputPayload body = mapper.readValue(jsonPayload, NotificationSubscriptionsputPayload.class);

String cardId = Arrays.asList("cardId_example").get(0);

NotificationSubscriptionsputResponse response = api.putnotificationSubscriptions(body, cardId);



//(from: NotificationSubscriptionsputPayload.class)



public NotificationSubscriptionsputPayload subscriptions(Subscriptions subscriptions) {
this.subscriptions = subscriptions;
return this;


Visa Dev Moderator

Re: Can not deserialize instance of



Thanks for bringing this to our notice. Please let me know if you are able to fix it by updating the model classes. We will take a look and plan for a fix in future release.




Regular Visitor

Re: Can not deserialize instance of

are you able to reproduce the issue on your end?


i'm also getting HTTP 400 Bad Request for all the other tests

Regular Visitor

Re: Can not deserialize instance of


Community Manager

Re: Can not deserialize instance of

@erek - are you still experiencing this? Please let me know.

Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.
Regular Contributor

Re: Can not deserialize instance of

I am getting the same error in Payment Account Validation API. Please help resolve this issue.

Regular Visitor

Re: Can not deserialize instance of

I used to have the same issue with the MerchantBenchmarkApiTest, but looks like the same problem in the serialization process.


The response json looked like this


"response": {
"responseData": [
     "groupName": "standard",
     "fraudChbktoSalesGrowthYoY": "-28.0456",
     "nonfraudChbktoSalesGrowthYoY": "36.5908",
     "fraudChbktoSalesRatio": "0.4564",
     "nonfraudChbktoSalesRatio": "0.209",
     "ticketGrowthMoM": "-0.0174",
     "ticketGrowthYoY": "0.0113",
     "salesTranCntGrowthMoM": "-3.3139",
     "salesVolumeGrowthMoM": "-4.9995",
     "salesTranCntGrowthYoY": "13.809",
     "salesVolumeGrowthYoY": "15.0983"


To me it just worked by changing the type of Object annotated in Jackson to List<Object> in

This is because it contains an array and during the serialization returns the error.



@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
private ResponseData responseData = null;


@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
private List<ResponseData> responseData = null;

Then change all the following accessors coherently.


Hope this helps to solve similar issues with other TEST Api.


New Contributor

Re: Can not deserialize instance of

SRC is currently in a limited release to eligible merchants, and the API is subject to change.

New Contributor

Re: Can not deserialize instance of

I had a similar issue with Global ATM Locator API with 74 java compilation errors on missing classes like ComplexType and with no reference, help or details on the same with sample code. And was unable to find an answer.. This answer at least helped me to resolve the compile time errors.