Fixed some JSON.parse error and set exception msg

Fixed some JSON.parse errors and set exception message correctly