<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Hashtable to JSON in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/hashtable-to-json/m-p/103467#M2369</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have the following code&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;var shaftCollection:ArrayCollection = new ArrayCollection();

 for(var i:uint = 0; i &amp;lt; shaftsManager.shafts.length; i++) {
&amp;nbsp; var shaft:Shaft = shaftsManager.shafts&lt;I&gt;;

&amp;nbsp; var shaftHash:Hashtable = new Hashtable;

&amp;nbsp; shaftHash.add("name", shaft.shaftName);
&amp;nbsp; shaftHash.add("priority", shaft.priorityInt);

&amp;nbsp; if(shaft.openSpace == null) {
&amp;nbsp;&amp;nbsp; //we have properties
&amp;nbsp; }
&amp;nbsp; else {
&amp;nbsp;&amp;nbsp; //we have an open space
&amp;nbsp; }

&amp;nbsp; shaftCollection.addItem(shaft);
 }

 jsonVar.add("inspection-area", insprectionArea);
 jsonVar.add("shafts", shaftCollection);

 Alert.show(JSON.encode(jsonVar));&lt;/I&gt;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;unfortunately the JSON that is returned is "{size:2}" and not a nice long string of JSON&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;why is this? and how do I go about converting a Hashtbale (or similar) to a JSON string?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Jan 2012 08:55:52 GMT</pubDate>
    <dc:creator>StevenColeman-Williams</dc:creator>
    <dc:date>2012-01-25T08:55:52Z</dc:date>
    <item>
      <title>Hashtable to JSON</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/hashtable-to-json/m-p/103467#M2369</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have the following code&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;var shaftCollection:ArrayCollection = new ArrayCollection();

 for(var i:uint = 0; i &amp;lt; shaftsManager.shafts.length; i++) {
&amp;nbsp; var shaft:Shaft = shaftsManager.shafts&lt;I&gt;;

&amp;nbsp; var shaftHash:Hashtable = new Hashtable;

&amp;nbsp; shaftHash.add("name", shaft.shaftName);
&amp;nbsp; shaftHash.add("priority", shaft.priorityInt);

&amp;nbsp; if(shaft.openSpace == null) {
&amp;nbsp;&amp;nbsp; //we have properties
&amp;nbsp; }
&amp;nbsp; else {
&amp;nbsp;&amp;nbsp; //we have an open space
&amp;nbsp; }

&amp;nbsp; shaftCollection.addItem(shaft);
 }

 jsonVar.add("inspection-area", insprectionArea);
 jsonVar.add("shafts", shaftCollection);

 Alert.show(JSON.encode(jsonVar));&lt;/I&gt;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;unfortunately the JSON that is returned is "{size:2}" and not a nice long string of JSON&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;why is this? and how do I go about converting a Hashtbale (or similar) to a JSON string?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jan 2012 08:55:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/hashtable-to-json/m-p/103467#M2369</guid>
      <dc:creator>StevenColeman-Williams</dc:creator>
      <dc:date>2012-01-25T08:55:52Z</dc:date>
    </item>
  </channel>
</rss>

