You need to sign in to do that
Don't have an account?
Deepikareddy
parse json to the selectlist
string jsonexample1 = ' { "overalldata": [ {"stateName": "Andrapradesh", "rating": 5.0 , "active": "yes" }, { "stateName": "Telangana", "rating": 4.0 ,"active": "no" }, {"stateName": "Banglore", "rating": 5.0 ,"active": "no"} , {"stateName": "Maharastra", "rating": 4.5 ,"active": "no" } ] } ';
how to parse the data and assign to Selectlist , itemlabel will be statename and itemvalue will be rating, based on selection i should display the rating value .. can any one help out thank u ...
thanks
deepika
how to parse the data and assign to Selectlist , itemlabel will be statename and itemvalue will be rating, based on selection i should display the rating value .. can any one help out thank u ...
thanks
deepika
Greetings to you!
Please try the below code, I have tested in my org and it is working fine. Kindly modify the code as per your requirement.
Visualforce:
Controller:
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
All Answers
Greetings to you!
Please try the below code, I have tested in my org and it is working fine. Kindly modify the code as per your requirement.
Visualforce:
Controller:
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
the json string format coming is:
string jsonData= ' { "sucess":1, "overalldata": [ {"stateName": "Andrapradesh", "rating": "5.0" , "active": "yes" }, { "stateName": "Telangana", "rating": "4.0" ,"active": "no" }, {"stateName": "Banglore", "rating": "5.0" ,"active": "no"} , {"stateName": "Maharastra", "rating": "4.5" ,"active": "no" } ] } ';
it is showing an Exception for me thank u..please let me know how to proced thank u
Deepika
https://www.biswajeetsamal.com/blog/json-response-parsing-in-salesforce-apex/
https://salesforce.stackexchange.com/questions/9328/how-to-parse-the-json-object-in-salesforce
https://json2apex.herokuapp.com/
Visualforce page is:
AFter debugging: iam getting the result as :
USER_DEBUG [29]|DEBUG|Respone- overalldata:[overalldata=(ContactWrapper:[rating=5.0, stateName=Andrapradesh], ContactWrapper:[rating=4.0, stateName=Telangana], ContactWrapper:[rating=5.0, stateName=Banglore], ContactWrapper:[rating=4.5, stateName=Maharastra])]
Can u please help to proceed to next step to add in the selectoption. please . .thank you
thanks and regards
deepika