convert file to dictionary