Can we pass HashMap from Javascript to controller? Where aMap['a123']=['xy','yz']; and aMap['b456']=['ab','bc']; I want a remote action method with Map> parameter in controller.


1 Answer 1


Yes, this is possible.

For your JS,

var aMap = {};

your remote method would need to look like this:

public PageReference doSometing(Map<String,List<String>>) {
    return null;

Best of luck!

  • Thanks @jeremy ! The Remote Method does not work using argument as Map<String,List<String>> but it takes the array as a string, so had to use Map<String,String> but this is not what i was expecting. Apr 14, 2015 at 23:50
  • the lesson here: never assume -- i was sure I had done map<str,list> before. Probably just maps of simple types, tho'. i will say that you could put a custom class in the signature -- it seems as though I've had lists as properties in a custom class -- i don't recall if it was a public Pageref, or a remoteAction tho'. worst case, you can always json serialize something and just have a string as the single method parameter. glad you got something working! Apr 20, 2015 at 22:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.