Handle strings with brackets better when converting to a dictionary