Factor out parsing of JSON arrays.