Fixed #111: accept JavaScript objects as input, and turn them into valid JSON