Assigning JSON string to apex:inputText

jQuery code:


Apex & Visualforce:

 public String stageName{set;get;}
 <apex:inputText value="{!stageName}" id="stageName"/>

Getting below text into stageName in apex through jQuery

    "New":["Prospect","Open","In Negotiation","Final Negotiation"],
    "Upsell":["In Negotiation","Lost"],

How to convert this JSON text into apex map like Map<String,List<String>>


Do something like,

String jsonInput = '{"New":["Prospect","Open","In Negotiation","Final Negotiation"],"Readoption":["Won"],"Rollover":["Won","Invoiced","Lost"],"Upsell":["In Negotiation","Lost"],"Conversion":[]}';
Map<String,List<String>> m = (Map<String,List<String>>)JSON.deserialize(jsonInput, Map<String,List<String>>.class);
| improve this answer | |
  • Please review How to Answer and provide an explanation to the above. – glls Jun 27 '18 at 0:05

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