try's should contain minimal code

specifically, the code that will raise the exception you want to catch;
the ValueError for invalid json
Cleanup code duplication, verbosity
Cleanup whitespace