Sign In Register

How can we help you today?

Start a new topic
Answered

"java.util.ArrayList cannot be cast to com.mongodb.DBObject" when trying to send a message

 sending jsonvar2 returns the error in the title, sending jsonvar works fine.

 

var jsonvar = { "data" : "mah data" };
var jsonvar2 = [{"data" : "mydata"}, {"data": "mydata2"}]

Spark.message("GAMESTART")
    .setPlayerIds([challengerID,challengedID])
    .setMessageData(jsonvar2)
    .send();

the var I want to send is much more complicated than jsonvar2 - basically an array of array with contents of either null or another object inside it. ie a map with units.


Best Answer

Hello guys,


the setMessageData() takes an object.


 

var jsonvar3 = {"arr":[{"data" : "mydata"}, {"data": "mydata2"}]} 

 


Should do the job.


Hope that helps,

Omar


1 person has this question

Hi, d deo.

I'm facing the same issue, have you found a solution yet?

Thanks.

Answer

Hello guys,


the setMessageData() takes an object.


 

var jsonvar3 = {"arr":[{"data" : "mydata"}, {"data": "mydata2"}]} 

 


Should do the job.


Hope that helps,

Omar


1 person likes this

It's working now. 

Thanks, Omar, for your help.

Login to post a comment