Fixing a bug in JSONEndpoint.  Fixes #23.