I am trying to use prestashop web service in order to get the categories name in json format for android but I am facing following problems:
1. I am not able to get the output in json, as it still showing the XML.
2. I don't know how to get List of names of category at a time.
can anyone help me out with atleast one example program to retrieve category names.
I was trying this in java before implementing it in android
try {
URL url = new URL("http://www.buyizy.com/api/categories/2?ws_key=QYEFPKCUYMKQF865248P5H2M5RGBXINJ&output_format=json");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Accept", "application/json");
if (conn.getResponseCode() != 200) {
throw new RuntimeException("Failed : HTTP error code : "
+ conn.getResponseCode());
}
BufferedReader br = new BufferedReader(new InputStreamReader(
(conn.getInputStream())));
String output;
System.out.println("Output from Server .... \n");
while ((output = br.readLine()) != null) {
System.out.println(output);
}
conn.disconnect();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}