Adding better separation between JSON protocol and internals