Added small tweaks to let the code compile
Wrapped ctor json parser with try/catch statements, Integer -> Int