Refactoring the code which reads json from incoming POST. Fixes #90.