Fix a bug in put/post of string content, also wrapped json parsing with try/catch so a more meaningful error can be reported.