Support Topics Documentation Slack YouTube Blog

"Wrong json format: Cannot deserialize instance of `java.util.HashMap` out of START_ARRAY token\n at [Source: UNKNOWN; line: -1, column: -1]"

Hello! I am using a method made in codeless. I downloaded a service with this method from the backendless. When calling this method, I get response: “Wrong json format: Cannot deserialize instance of java.util.HashMap out of START_ARRAY token\n at [Source: UNKNOWN; line: -1, column: -1]”
My method in swift:
class SalkiService: NSObject {
static let shared = SalkiService()
private let serviceName = “SalkiService”
func saveAttempt(time: Float, trackId: String, responseHandler: ((Any?) -> Void)!, errorHandler: ((Fault) -> Void)!) {
Backendless.shared.customService.invoke(serviceName: serviceName, method: “saveAttempt”, parameters: [time, trackId], responseHandler: responseHandler, errorHandler: errorHandler)
}
}

MyAppId: A87C0519-FB6B-4A6F-FF50-50359BE40900

Hi, @Petr_Kibukevich!

We are already investigating your problem. I will let you know when we solve it.

Hello Petr,

According to your logic, the saveAttempt functions’s parameter is object (map), not array:

body

that’s why you get that error. Please change to

func saveAttempt(time: Int, trackId: String, responseHandler: ((Any?) -> Void)!, errorHandler: ((Fault) -> Void)!) {
    Backendless.shared.customService.invoke(serviceName: serviceName, method: "saveAttempt",  parameters: ["time": time, "trackId": trackId], responseHandler: responseHandler, errorHandler: errorHandler)
}

Regards,
Olha

Thank you, but I did not write this method on swift myself, it was generated by the backendless. Therefore, this is an obvious bug of the backendless

on all my previous projects, I downloaded the generated by the backendless to swift service I created and everything worked

OK I see,
we’ve created the internal ticket BKNDLSS-20115 and will investigate this issue as soon as possible.

Regards,
Olha

The fix is done and will appear on server in the nearest future.

Regards,
Olha