parse API input into correct data objects