I am having trouble parsing the object correctly. This code is on the backend.
var dummy = { rohan: "sharma" };
var downButton ='<input type="button" value="Download" onclick="downloadFileAutomatically(\'' + JSON.stringify(dummy) +'\')" />';
On the front end this renders as
<input type="button" class="btn btn-link btn-xs" value="Download JSON" onclick="downloadFileAutomatically('{" rohan":"sharma"}')"="">
the )"=""
section at the end is random and wrong.
On clicking this button the browser throws Uncaught SyntaxError: Invalid or unexpected token
which is expected behavior.
How should I handle the quotes hierarchy for this to work.