Fix parsing of JSON API