moved JSON.parse calls into helper method