convert a string to a dictionary