Protecting against malformed json