JSON, routing

fixed routing, made it REST compliant, added JSON output by default.