#342: Properly return JSON object

Resolves #342.