<?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 Re: Exporting to JSON in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/exporting-to-json/m-p/7813118#M6945</link>
    <description>&lt;P&gt;I'm not sure whether I fully understand what you want to do.&lt;/P&gt;
&lt;P&gt;Do you want to write everything that you write to the text screen with &lt;FONT face="courier new,courier"&gt;acutPrintf(...)&lt;/FONT&gt; into a JSON file?&lt;/P&gt;
&lt;P&gt;You could try to redefine &lt;FONT face="courier new,courier"&gt;acutPrintf()&lt;/FONT&gt; as a &lt;A title="Variadic-Macros" href="https://msdn.microsoft.com/de-de/library/ms177415.aspx" target="_blank"&gt;variadic macro&lt;/A&gt;, that formats the string with &lt;FONT face="courier new,courier"&gt;acutSPrintf(ACHAR *buffer, ...)&lt;/FONT&gt;, than calls &lt;FONT face="courier new,courier"&gt;acutPrintf(L"%s", buffer)&lt;/FONT&gt;and finally writes &lt;FONT face="courier new,courier"&gt;buffer&lt;/FONT&gt; into your JSON file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Feb 2018 17:14:04 GMT</pubDate>
    <dc:creator>tbrammer</dc:creator>
    <dc:date>2018-02-27T17:14:04Z</dc:date>
    <item>
      <title>Exporting to JSON</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/exporting-to-json/m-p/7811836#M6944</link>
      <description>&lt;P&gt;I want to export all the information that i am printing on Autocad console to a json file.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have gone through the spotify, nholmann,s code. But those are not working.&lt;/P&gt;&lt;P&gt;As i am working in c++ on my plugin, i want to export the data to json.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2018 10:07:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/exporting-to-json/m-p/7811836#M6944</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-02-27T10:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting to JSON</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/exporting-to-json/m-p/7813118#M6945</link>
      <description>&lt;P&gt;I'm not sure whether I fully understand what you want to do.&lt;/P&gt;
&lt;P&gt;Do you want to write everything that you write to the text screen with &lt;FONT face="courier new,courier"&gt;acutPrintf(...)&lt;/FONT&gt; into a JSON file?&lt;/P&gt;
&lt;P&gt;You could try to redefine &lt;FONT face="courier new,courier"&gt;acutPrintf()&lt;/FONT&gt; as a &lt;A title="Variadic-Macros" href="https://msdn.microsoft.com/de-de/library/ms177415.aspx" target="_blank"&gt;variadic macro&lt;/A&gt;, that formats the string with &lt;FONT face="courier new,courier"&gt;acutSPrintf(ACHAR *buffer, ...)&lt;/FONT&gt;, than calls &lt;FONT face="courier new,courier"&gt;acutPrintf(L"%s", buffer)&lt;/FONT&gt;and finally writes &lt;FONT face="courier new,courier"&gt;buffer&lt;/FONT&gt; into your JSON file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2018 17:14:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/exporting-to-json/m-p/7813118#M6945</guid>
      <dc:creator>tbrammer</dc:creator>
      <dc:date>2018-02-27T17:14:04Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting to JSON</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/exporting-to-json/m-p/7814605#M6946</link>
      <description>&lt;P&gt;Yes, initially i want to do exactly what you said.&lt;/P&gt;&lt;P&gt;But i was thinking that i need to include some json libraries first or some include directories for exporting everything to json.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is your solution create a new json file and put all my text into that? Or it is totally a different method.&lt;/P&gt;&lt;P&gt;I want to know as i am stuck in this exporting problem.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 05:09:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/exporting-to-json/m-p/7814605#M6946</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-02-28T05:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting to JSON</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/exporting-to-json/m-p/7814957#M6947</link>
      <description>&lt;P&gt;There is no JSON API in ObjectARX.&amp;nbsp; You could either simply write the strings in JSON format using basic C++ I/O functions and do the formatting yourself, or you can use any available JSON C++ lib that suit your needs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It depends on your needs how you manage to create the JSON output. Let's say in your ARX you call&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;acutPrintf(L"My first line");
acutPrintf(L"My second line");&lt;/PRE&gt;
&lt;P&gt;and you want your JSON to look like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;{ "TextScreen": [ ""&lt;BR /&gt;,"My first line"&lt;BR /&gt;,"My second line" &lt;BR /&gt;]}&lt;/PRE&gt;
&lt;P&gt;To make sure that you get a valid JSON:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;your output needs a "header line" like the above line&amp;nbsp;&amp;nbsp; &lt;FONT face="courier new,courier"&gt;{ "TextScreen": [ ""&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;you have to comma-separate the strings in each output from &lt;FONT face="courier new,courier"&gt;acutPrintf()&lt;/FONT&gt;. No comma after last entry!&lt;/LI&gt;
&lt;LI&gt;you have to make sure that you add a "footer line" like the line &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;FONT face="courier new,courier"&gt;])&amp;nbsp; &lt;/FONT&gt;to terminate your JSON. &lt;BR /&gt;Ask yourself at which point you need the proper termination line.&lt;/LI&gt;
&lt;LI&gt;Take care with special characters. I.e. newline (\n) should be replaced by L"\\n".&amp;nbsp;&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Wed, 28 Feb 2018 08:44:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/exporting-to-json/m-p/7814957#M6947</guid>
      <dc:creator>tbrammer</dc:creator>
      <dc:date>2018-02-28T08:44:42Z</dc:date>
    </item>
  </channel>
</rss>

