Hi guys
I am very new to the forum
i am providing a json response with recursive looping
import org.json.simple.JSONObject;
public class JsonClass {
public static void main(String args[])
{
System.out.println(call(5));
}
public static int call(int i)
{
if(i==1)
{
return 1;
}else
{
JSONObject jsObj=new JSONObject();
if(i>3)
{
jsObj.put("children", i);
}
jsObj.put("id", i);
System.out.println(jsObj);
return i*call(i-1);
}
}
}
o/p
{"id":5,"children":5}
{"id":4,"children":4}
{"id":3}
{"id":2}
my requirement is to place another child inside 5 as below
{"id":5,"children":5,"anotherchildren":"something"}
{"id":4,"children":4}
{"id":3}
{"id":2}
do you have any idea
karthik.k
--
View this message in context:
http://old.nabble.com/Doubt-in-json-response-tp27664575p27664575.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]