Thursday, 15 September 2011

Create json array with hashtable in java -


I have a JSONObject () or GSN Library from Google from hashtable in Google

Any help on this is appreciated!

  JSONObject message = new JSONObject (); Click the & lt; String, string & gt; FeedbackData = NewHashTable & lt; String, string & gt; ();  

[...]

  As a result result = getApprovalCount.executeQuery (); While (results.next ()) {responseData.put ("vote" + results.getString ("submission_id"), results.getString ("counter")); }  

[...]

  messages. Input ("Submissions", Feedback Data); "Vote1": "2", "Vote 7": "1", "Vote 25": " 

Result:

  {" submissions "1", "Vote 6": "1", "Vote 13": "1", "Vote 9": "1", "Vote11": "1"}}  
< P> Result: {"Vote1": "2"}, {"vote7": "1"}, {"vote25": "1"}, {"vote6": "1"}, {"vote 13 "": "1"}, {"vote9": "1"}, {"vote11": "1"}}}

understood it ...!

  JSONObject message = new JSONObject (); ArrayList & LT; Maps & LT; String, string & gt; & Gt; FeedbackData = New Arrestist & lt; Maps & lt; String, string & gt; & Gt; (); User user = new user (request);  

[...]

  while (results.next ()) {map & lt; String, string & gt; Tmpdata = New Hashtable & lt; String, string & gt; (); Tmpdata.put ("vote" + results.getString ("submission_id"), result .getString ("counter"); ResponseData.add (tmpdata); }  

[...]

  messages. Input ("Submissions", Feedback Data);  

No comments:

Post a Comment