Fix parsing of JSON API

The previous method would result in an error that returned `KeyError: 'json'`.