I'm creating a bookmarklet that will accept a JSON string through a prompt like so:
prompt("Enter your JSON", "");
Once they enter their JSON string, I convert their string into a JSON Object using JSON.parse
. Unfortunately, as far as I can tell JSON.parse
is not supported in IE9. The object of my bookmarklet is to loop through the available <input>
's on the page and fill their values with data from my JSON object.
What can I do in order to get this to work in IE9?
One possible solution - This answer: https://stackoverflow.com/a/7146404/556079 suggests that JSON.parse
will work if my document is in standards mode. Since this is a bookmarklet, I have no control over the doctype of the page. Would it be possible to change the doctype using my bookmarklet?
I would prefer to avoid loading libraries in my bookmarklet like http://bestiejs.github.io/json3. If this can be done without resorting to that, that would be ideal.
Alternatively, the input doesn't need to even be a JSON. I just need to get some user submitted data into a loop where I can reference anywhere between 2 and 50 values.