0

My JSON response contains characters in decimal format such as

My Friend's Story

instead of

My Friend's  Story

How do I convert them properly?

Ragunath Jawahar
  • 19,513
  • 22
  • 110
  • 155

2 Answers2

2

See Decode HTML entities in android

Community
  • 1
  • 1
methodin
  • 6,717
  • 1
  • 25
  • 27
0

That's simple: You can use org.json.JSONTokener to solve your problem....

String json = "\"My Friend's Story\""; 
String value = (String)new JSONTokener(json).nextValue();
Buhake Sindi
  • 87,898
  • 29
  • 167
  • 228
  • Why would that work? That's a HTML entity, not JSON quoting (which tokener would handle) – StaxMan Nov 02 '10 at 16:34
  • @StaxMan, unfortunately Google didn't include `XMLTokener` (which is available on org.json site. My thought is that they probably included some html decoding in the JSONTokener. – Buhake Sindi Nov 03 '10 at 09:15