Fix JSON support

Fixes #561

Signed-off-by: Michal Čihař <michal@cihar.com>