Added json api

Resolves #6 
lets wrap this in an option thats disabled by default