Make general function for Convert string to Dictionary.