Dear dancer experts,<div>                               I have a 1D Perl array which I would like to encode using JSON and send it as a response to an ajax request. </div><div><br></div><div>I have implemented the following steps so far in my dancer app: </div>

<div><br></div><div><i>use Dancer::Plugin::Ajax;</i></div><div><i>set serializer =&gt; &#39;JSON&#39;;</i></div><div><i><br></i></div><div><div><i>ajax &#39;/getarray&#39; =&gt; sub {</i></div><div><i><br></i></div><div>
<i>    my @sendArray;</i></div>
<div><i>      ...........  </i></div><div><i>   {</i></div><div><i>       @sendArray;  # this is the array I intend to send to the client Java Script</i></div><div><i>   }</i></div><div><i>  </i></div><div><i>};</i></div>

</div><div><br></div><div> The sendArray is not a (key, value) pair based structure, but a simple 1D array.</div><div> Can anyone let me know if <i> &quot;@sendArray&quot;</i> statement at the end of  ajax routine above will correctly encode to JSON?</div>

<div><br></div><div>Also is there any way to print (to console) the final encoded JSON object from the ajax routine at the server end? </div><div><br></div><div>thanks in advance</div><div>\amk</div><div><br></div><div><br>

</div>