Function to parse data