0

my JSON response is as given below JSON response is

{"code":201,"message":[["TEST Action","NA","30-11--2011"],["TEST Action 2","NA","30-11--2011"]]}.

i want to take the data correspond to 'message'.i used JSON Array.and got response as JSON array response is

[["TEST Action","NA","30-11--2011"],["TEST Action 2","NA","30-11--2011"]].

Now how can i access each array in that?

0

2 Answers 2

0

You should expand on what you have done, what language you are using, etc. Normally, you should be able to index into the array with the standard notation. In python for example you can do something along the lines of json_data["message"][0] to access the first array and json_data["message"][1] to access the second.

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

4 Comments

in Java or in Android?
@user3495439 That is an example in python. Once the json data is loaded into a dictionary you can treat it as a python dict.
in my code i retrieve the data as jsonResponse.get("message").
@user3495439 Depending what library you are using and what the method returns, you should be able to index into an array of some sort.
0

something like :

  var d = JSON.parse('{"code":201,"message":[["TEST Action","NA","30-11--2011"],["TEST Action 2","NA","30-11--2011"]]}')

and then you can access each array in message part as :

  d.message.forEach(function(obj) { console.log(obj); });

1 Comment

Didn't see your comment for Java/Android before. You can refer to this solution for Java : stackoverflow.com/a/20349690/3660930

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.