Set numeric precision before using json_encode(). Closes #47.