Json option added

I HIGHLY recommend looking over (and probably even testing) my changes in both the code and the doc just to make sure everything makes sense.