More robust JSON handling

Because @sgentle kept breaking things.
0.0.23