You can use input.value = JSON.stringify(obj)
to transform the object to a string.
And when you need it back you can use obj = JSON.parse(input.value)
The JSON object is available on modern browsers or you can use the json2.js library from json.org