Hay guys, i’ve made a simple drawing application using the canvas tag. However i would like to export the data to JSON so it can be saved.
How does one go about this?
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.
What you need is the toDataUrl(type) method. It will return a data: URI – a plain string which you can easily put in a JSON structure or do what you want with. Example:
Tested in Opera 10.0. You can also try .toDataURL(“image/jpeg”)