title: Primefaces callback with JSON as callback parameter
body: <p>I am trying to pass Json as callback parameter. Can anyone correct the javascript to get the values from the json object?</p>
  
  <p>javascript</p>
  
  <pre><code>function renderTopic(xhr,status,args){
          alert("iam In renderTopic");
          var topicObject = $.parseJSON(args.topicJSON);
          for(var x in topicObject){
              alert(x.topicBody);
          };
      }
  </code></pre>
  
  <p>Server side</p>
  
  <pre><code>   jGenerator.writeFieldName("topicBody");
              jGenerator.writeStartArray();
                   ...............
              jGenerator.close();
               context = RequestContext.getCurrentInstance();
               System.out.println("JSON output in string "+out.toString())
  </code></pre>
  
  <p>xhtml</p>
  
  <pre><code>&lt;p:commandLink action="#{topicController.listAllTopics}"
                  id="topicListAllCmdLink" value="" oncomplete="javascript:renderTopic(xhr, status,args)"/&gt;
  </code></pre>
  
  <p>http response</p>
  
  <pre><code>&lt;partial-response&gt;&lt;changes&gt;&lt;update id="javax.faces.ViewState"&gt;&lt;![CDATA[4091946826703479326:-2361306414195161728]]&gt;&lt;/update&gt;&lt;extension ln="primefaces" type="args"&gt;{"topicJSON":"{\"topicBody\":[\"Test10\",\"Test22\",\"Test4\",\"Test11\"]}"}&lt;/extension&gt;&lt;/changes&gt;&lt;/partial-response&gt;
  </code></pre>