For some reason, the accepted answer worked for me only if being used once on the page, but in my case I was trying to save data on many elements on the page and the data was somehow lost on all except the first element.
As an alternative, I ended up writing the data out to the dom and parsing it back in when needed. Perhaps it's less efficient, but worked well for my purpose because I'm really prototyping data and not writing this for production.
To save the data I used:
$('#myElement').attr('data-key', JSON.stringify(jsonObject));
To then read the data back is the same as the accepted answer, namely:
var getBackMyJSON = $('#myElement').data('key');
Doing it this way also made the data appear in the dom if I were to inspect the element with Chrome's debugger.