I put a key-value pair in a Java HashMap and converted it to a String using the toString() method.
Is it possible to convert t
i converted HashMap into an String using toString() method and pass to the another method that take an String and convert this String into HashMap object
This is a very, very bad way to pass around a HashMap.
It can theoretically work, but there's just way too much that can go wrong (and it will perform very badly). Obviously, in your case something does go wrong. We can't say what without seeing your code.
But a much better solution would be to change that "another method" so that it just takes a HashMap as parameter rather than a String representation of one.