Monday, 15 July 2013

java - Need to change my code to generate correct JSON object -


I am trying to generate the following JSON to access via tokenInput, but my code prepares it in another way Is, how can I tailor the code to generate the correct JSON?

Required Jason

  [{id: "set", name: "set"}, {id: "object",} Name = "object"}   

My JSON

  {"get": [{"id": "set", "name": "set"}, {"id ":" Object "," name ":" object "}}}   

MyCode

  JSONObject res = new JSONObject (); JSONArray jarray = New JSONArray (); JSONObject object = new JSONObject (); Object.put ("id", "set"); Object.put ("name", "set"); Jarray.add (object); JSONObject object1 = new JSONObject (); Object1.put ("id", "object"); Object1.put ("name", "object"); Jarray.add (object1); Res.put ("mill", jerre); Return ridge;   

JSP

  $ (document) .ready (function () {$ ("# items"). TokenInput ( "GetOptions.jsp", {subject: "facebook"})}}    

  [{"id": "set", "name": "set"}, {"id": "object", "name": "object"}]   

This can be just a form, as the form generates ur code. Resend a JSONArray Try again!

No comments:

Post a Comment