3

I am trying to parse JSON data which is in HTML format. I am not understanding how to implement it.

My JsonObject as shown below :

{"Content":
{
"PageContent":"<table cellpadding=\"1\" cellspacing=\"0\">\r\n\t<tr><td colspan=\"2\" style=\"font-weight:bold; font-style:italic; font-size:24px; color:Red; text-decoration:blink;\">Contact Us</td></table>"
}
}

I want to load jsonobject i.e. menuPageContent which is HTML format to WebView.

halfer
  • 19,824
  • 17
  • 99
  • 186
Rahul Baradia
  • 11,802
  • 17
  • 73
  • 121

2 Answers2

4

Hope you know how to implement JSON Parsing in Android?

Still, here is a way to get menuPageContent from above json:

String myJSONData = "place your data here";
JSONObject objJSON = new JSONObject(myJSONData);
JSONObject subObj = objJSON.getJSONObject("MenuContent");
String webData = subObj.getString("menuPageContent");

myWebView.loadData(webData, "text/html; charset=UTF-8", null);

Read more about WebView.

Community
  • 1
  • 1
Paresh Mayani
  • 127,700
  • 71
  • 241
  • 295
0

This link will be help to you

http://code.google.com/p/google-gson/

webview hav load data and you can use that

Gson gson = new Gson();
MyModel model = gson.fromJson("YOUR JSON DATA HERE", MyModel.class);
webView.loadData(model.menuPageContent, "text/html; charset=UTF-8", null);
android
  • 101
  • 1
  • 1
  • 7
  • sorry, this couldn't help me out. Please check the question. I want to load it to WEBVIEW. The Json I am able to get it. – Rahul Baradia Jan 17 '13 at 07:28