2
JSONObject  jObject = new JSONObject(myJsonContent);
JSONObject menuObject = jObject.getJSONObject(String.valueOf(jObject.keys().next()));

myJsonContent is response from server and i dont know what is start tag ... and i dont want to know even...

and after that without knowing any tag of response i want to parse response..

this is requirment because in the future we will not be knowing if server guys change data and tags as well so we need to create like this which will be work even if server guys changes all the tags in future

please help me any kind of help is very appriciable

4
  • What do you mean by 'start tag'? Commented Mar 11, 2011 at 12:29
  • start Tag means from where my xml starts where i will start parsing Commented Mar 25, 2011 at 11:13
  • Thanks for considering my question Dre :) Commented Mar 25, 2011 at 11:13
  • Sorry, but I still don't get it. Why is there an xml tag in your JSON string? Commented Mar 25, 2011 at 13:09

2 Answers 2

2

You should check here,

http://developer.android.com/reference/org/json/JSONObject.html

get keys from json object i.e. iterator and loop thorough it and use jsonObject.names() to get the array of names. This should guide you to the right solution.

Sign up to request clarification or add additional context in comments.

2 Comments

sorry but this i have already checked i didnt get any solotuion with iteration as well ..... can you please show me how to do it.......thanks for this precious reply.
sorry but this i have already checked i didnt get any solotuion with iteration as well ..... can you please show me how to do it.......thanks for this precious reply.
0

Sorry for the plug, but you could try do what I did - use this parsing object generator

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.