<?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 Convert graphiclayer to JSON in ArcGIS Runtime SDK for Android Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/convert-graphiclayer-to-json/m-p/151117#M1077</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is there a way to convert GraphicsLayer to JSON&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;when user draws a relining(lines, points and polygon) and i need to give option to save this redling data in a SQLLite database, so that user can view the saved redling in feature.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;to make this i need to convert the graphic layer to json.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;PGowda&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 03 Oct 2013 07:11:26 GMT</pubDate>
    <dc:creator>papegowda1</dc:creator>
    <dc:date>2013-10-03T07:11:26Z</dc:date>
    <item>
      <title>Convert graphiclayer to JSON</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/convert-graphiclayer-to-json/m-p/151117#M1077</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is there a way to convert GraphicsLayer to JSON&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;when user draws a relining(lines, points and polygon) and i need to give option to save this redling data in a SQLLite database, so that user can view the saved redling in feature.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;to make this i need to convert the graphic layer to json.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;PGowda&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Oct 2013 07:11:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/convert-graphiclayer-to-json/m-p/151117#M1077</guid>
      <dc:creator>papegowda1</dc:creator>
      <dc:date>2013-10-03T07:11:26Z</dc:date>
    </item>
    <item>
      <title>Re: Convert graphiclayer to JSON</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/convert-graphiclayer-to-json/m-p/151118#M1078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If this answer helps you, please mark it as an answer. &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There are a couple of ways that you can go about this depending on your needs and if you are interested is saving all of the graphics in a layer at once, or if you need to save them one at a time...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Use a FeatureSet. Add all of graphics to a FeatureSet and then use FeatureSet.toJson() to serialize it and FeatureSet.fromJson() to deserialize it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Serialize the main components of an individual graphic separately (if all you care about is geometry and you are programmatically defining a symbol, you don't really need to worry about saving the symbol or attributes).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[INDENT]a) Geometry: use GeometryEngine.geometryToJson() / GeometryEngine.jsonToGeometry()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;b) Symbol: use Symbol.toJson() / SymbolHelper.createSymbol()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;c) Attributes: use new JSONObject(graphic.getAttributes()).toString() / new JSONObject(jsonAttributes)[/INDENT]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the case of the attributes for option #2, when you deserialize them you'll have to loop through jsonObject.keys() and build a Map&amp;lt;String, Object&amp;gt; of attributes to use when recreating the graphic.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Oct 2013 20:31:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/convert-graphiclayer-to-json/m-p/151118#M1078</guid>
      <dc:creator>JasonKnisley</dc:creator>
      <dc:date>2013-10-03T20:31:36Z</dc:date>
    </item>
  </channel>
</rss>

