title: How to Use JSON Accumulate Method With List?
body: <p>I am trying below code....</p>
  
  <pre><code>public  String listToJsonString(String keyName, List&lt;StyleAttribute&gt; attrs) {
          JSONObject json = new JSONObject();
          json.accumulate(keyName, attrs);
          return json.toString();
      }
  </code></pre>
  
  <p>But when i am checking <strong>json</strong> variable it contains empty values something like below </p>
  
  <blockquote>
    <p>{"myKey":[{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}]}</p>
  </blockquote>
  
  <p>And when i am checking <strong>attrs</strong> variables it contains 22 element Data.What i am doing Wrong here? I am just converting my List to Json Object and save to Database.
  I am using </p>
  
  <pre><code>import net.sf.json.JSONArray;
  import net.sf.json.JSONException;
  import net.sf.json.JSONObject;
  </code></pre>