Update shared-method.js

Catch exception when parsing JSON