You need to sign in to do that
Don't have an account?
Shiva Prasad Achukatla 22
loop through apex map in javascript
Hi,
I want to loop through apex map in Javascript.
My map is like below
Map<string,list<wrapperObject>> Map_Of_AnswerGroup_childQuestionsGroup = new Map<string,list<warpperObject>>();
public String Map_Of_AnswerGroup_childQuestionsGroup_JSON {get;set;}
consrtuctor(){
if(!this.Map_Of_AnswerGroup_childQuestionsGroup.isEmpty())
{
system.debug('debug at 534'+this.Map_Of_AnswerGroup_childQuestionsGroup);
Map_Of_AnswerGroup_childQuestionsGroup_JSON = JSON.serialize(this.Map_Of_AnswerGroup_childQuestionsGroup.isEmpty());
}
}
'Map_Of_AnswerGroup_childQuestionsGroup_JSON ' is retruning false after serlization.
Could someone help me around this.
The main purpose of this is to be able to loop through map elements in javascript and form dynamic mark up.
I want to loop through apex map in Javascript.
My map is like below
Map<string,list<wrapperObject>> Map_Of_AnswerGroup_childQuestionsGroup = new Map<string,list<warpperObject>>();
public String Map_Of_AnswerGroup_childQuestionsGroup_JSON {get;set;}
consrtuctor(){
if(!this.Map_Of_AnswerGroup_childQuestionsGroup.isEmpty())
{
system.debug('debug at 534'+this.Map_Of_AnswerGroup_childQuestionsGroup);
Map_Of_AnswerGroup_childQuestionsGroup_JSON = JSON.serialize(this.Map_Of_AnswerGroup_childQuestionsGroup.isEmpty());
}
}
'Map_Of_AnswerGroup_childQuestionsGroup_JSON ' is retruning false after serlization.
Could someone help me around this.
The main purpose of this is to be able to loop through map elements in javascript and form dynamic mark up.
Here is the APEX code.
And, the Javascript
You are welcome to make it work for parsing Map object as well.
If you find it difficult, I suggest you convert your Map into a list, because it works like breeze with a List.
Hope this helps.