Various JSON additions

Fixes #698