Change config format to JSON.

Grab some parsing and error handling code from camlistore