Fix JSON token parsing

Closes #8