I want to call a web service that return an image as JSON. But i do not know how I can display the returned JSON as an image inside HTMl page.?
Best Regards
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your question leaves out some very important details, but assuming that the returned JSON has a string which is a base64-encoded image, you could use that string as the content of a
dataURI as thesrcof animgelement (assuming a compatible browser). More on usingdataURIs as images here.Example:
Live Copy | Source
Of course, if the JSON contains a link to the image, you’d just use that link directly as
srcrather than using adataURI.