added exception handling when parsing JSON