You need to sign in to do that
Don't have an account?
Deepikareddy
Json parser in salesforce
string jsonexample1 = ' { "states" : [ "india", "alaska", "china" ] } ';
how to parse the data in the picklist in the apex:repeat functionalities ,
Another scenario :
if the data is
string jsonexample2 = ' { "overalldata": [ {"stateName": "Andrapradesh", "taxpercent": 15.0 }, { "stateName": "Telangana", "taxpercent": 18.0 }, {"stateName": "Banglore", "taxpercent": 16.0 } , {"stateName": "Maharastra", "taxpercent": 14.0 } ] } ';
here i need to get the statename in the picklist and taxpercent in a Repeat table .. can anybody guide me how to proceed thanks ...
how to parse the data in the picklist in the apex:repeat functionalities ,
Another scenario :
if the data is
string jsonexample2 = ' { "overalldata": [ {"stateName": "Andrapradesh", "taxpercent": 15.0 }, { "stateName": "Telangana", "taxpercent": 18.0 }, {"stateName": "Banglore", "taxpercent": 16.0 } , {"stateName": "Maharastra", "taxpercent": 14.0 } ] } ';
here i need to get the statename in the picklist and taxpercent in a Repeat table .. can anybody guide me how to proceed thanks ...
statemap.put(statename, rating);
activestatusmap.put(statename, activestatus);
and in visualforce page:
<td>{!activestatusmap[a]}</td>
Your key remains same that is 'statename'.
May be just read through the concept of maps in Apex to understand better.
Thanks.
All Answers
I did like this:
This is my result:
Thanks.
I hope you find the above solution helpful.
Thanks and Regards,
Neha Aggrawal
www.initaura.com - Everything Salesforce (https://www.initaura.com)
What error ar you getting. Please post the code here.
Thanks.
hi neha, iam getting the value, but it is gettng iterating again and again , if i am doing it iterable when iam using the html table, , please find the screenshot attached .. but it should not get iterate.. can u please provide the solution for this .. thanks in advance
The reason this ia hapening because you are running two loops with two <apex:repeat>. The easier way to find this is simply to add a debug statement in your apex class, somehting like "System.debug(lststatename);".
When that prints correctly you know, that issue is with the visualforce page.
This is the updated code:
I have just made a map and printed that in a single loop.
I hope you find the above solution helpful.
Thanks and Regards,
Neha Aggrawal
www.initaura.com - Everything Salesforce (https://initaura.com)
if i need to add some other values to the repeat tag then?
like :
extra values like : activestatus and pincode, then how to proceed, any idea ,
it will be helpfull in future , such that not to post again for the same query..
thanks
deepika.
statemap.put(statename, rating);
activestatusmap.put(statename, activestatus);
and in visualforce page:
<td>{!activestatusmap[a]}</td>
Your key remains same that is 'statename'.
May be just read through the concept of maps in Apex to understand better.
Thanks.
thanks !
Deepika