- add trivial JSON marshalling error handling
- update code formatting