If you aren't familiar with Json, then you best read up. Here's the documentation for Json.js.
the .encode() method of the Json object will convert an object to a JSON string that can be evaluated back into the object.
Json.encode({apple: 'red', lemon: 'yellow'}); //returns: '{"apple":"red","lemon":"yellow"}'
Json.decode('{"apple":"red","lemon":"yellow"}'); //returns the object again: {apple: 'red', lemon: 'yellow'}
A second argument for Json.decode exists to first check that the response is valid Json. This security method ensures that you don't evaluate malicious code:
Json.decode('{"apple":"red","lemon":"yellow"}', true); //returns the object again: {apple: 'red', lemon: 'yellow'}
Json.decode("alert('you just got haxored!')", true); //returns null