how can I convert a JSONObject like "{hello1: hi, hello2: hey}" to "hello1: hi, hello2: hey" without these brackets { } ?
I know that there is a opportunity to use JSONObject.tostring but then I'll get a string with the brackets.
Thanks all.
Just do a substring or string replace.
Pseudo substring Example:
JSONObject a  = new JSONObject("{hello1: hi, hello2: hey}");
String b = a.toString().substring(1, a.toString().length() - 1);
Pseudo string replace Example:
JSONObject a  = new JSONObject("{hello1: hi, hello2: hey}");
String b = a.toString().replace("{", "");
String c = b.toString().replace("}", "");
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With