Method JSON representation, nested arrays

Feb 12, 2014 at 4:39 PM
Hey All,

I'm stumped in trying to figure out the correct JSON for my method below. Does anyone have an idea?
[JsonRpcMethod]
private externalDataTypes.Result executeCommand(String deviceID, String command, params object[] parameters)
I've tried a couple of different requests, resulting in a variety of Parse error exceptions being throw by the library. This is what I've tried to far:
{"method":"executeCommand","params":["testDevice1","addNumbers",[10,10]],"id":1}
{"method":"executeCommand","params":["testDevice1","addNumbers",10,10],"id":1}
{"method":"executeCommand","params":["testDevice1","addNumbers",[{10},{10}]],"id":1}
What I'm trying to achieve is essentially to be able to accept an unspecified number / type of parameters as an array. Then I'll forward these parameters onto my reflection based device handling system.

Jan
Feb 12, 2014 at 4:52 PM
Strange, it appears my first try was correct, this ended up working correct after some more trial & error:
{"method":"executeCommand","params":["testDevice1","addNumbers",[12,10]],"id":1}
Marked as answer by janbreens on 2/12/2014 at 9:52 AM