Throw meaningful error if parsing json fails
Add test for throwing