Refactor parsing json array