java json/object to array

Posted by heldopslippers on Stack Overflow See other posts from Stack Overflow or by heldopslippers
Published on 2010-04-12T14:22:43Z Indexed on 2010/04/12 18:43 UTC
Read the original article Hit count: 502

Filed under:
|
|

Hi people. I have a question about type casting. I have the following json String:

{"server":"clients","method":"whoIs","arguments":["hello"]}

I am parsing it to the following Map< String, Object>

{arguments=[hello], method=whoIs, server=clients}

It is now possible to do the following:

request.get("arguments");

This works fine. But i need to get the array the is stored in the arguments. How can i accomplish this? I tried (for example) the following:

System.out.println(request.get("arguments")[0]);

But of course this doesn't work.. Does anybody know how this would be possible?

© Stack Overflow or respective owner

Related posts about java

Related posts about JSON