I am trying to parse a string using Gson
String str = "{key=sample value}";
new Gson().fromJson(str, HashMap.class())
I am getting a JSONSyntax exception for this. If I change the string to "{key=samplevalue}" it works fine(removed space). Can anyone please explain. What should be done so that I get hashmap as "key" = "sample value"
"{\"key\"=\"sample value\"}"