Made json encoder configurable

Mochijson2 is used by default