<?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: GetJSON from external source and map it to a info table in ThingWorx Developers</title>
    <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/GetJSON-from-external-source-and-map-it-to-a-info-table/m-p/675308#M46284</link>
    <description>&lt;P&gt;Resources["ContentLoaderFunctions"].GetJSON returns a JSON-Object so you don't need to convert it with ToJSON(). You can use this JSON-object like every other JSON-object. You can iterate through JSON as well as iterate through a info table.&lt;/P&gt;
&lt;P&gt;I think it makes sense to see what your JSON object looks like:&lt;/P&gt;
&lt;P&gt;logger.debug("jsonData: " + JSON.stringify(jsonData))&lt;/P&gt;</description>
    <pubDate>Thu, 02 Jul 2020 11:48:33 GMT</pubDate>
    <dc:creator>drichter</dc:creator>
    <dc:date>2020-07-02T11:48:33Z</dc:date>
    <item>
      <title>GetJSON from external source and map it to a info table</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/GetJSON-from-external-source-and-map-it-to-a-info-table/m-p/675013#M46250</link>
      <description>&lt;P&gt;I am trying to iterate through a JSON and map it to info table (later show the data calculated in a mashup).&lt;/P&gt;
&lt;P&gt;Based on this article:&amp;nbsp;&lt;A href="https://www.ptc.com/en/support/article/CS179012" target="_self"&gt;How to convert JSON to an InfoTable in ThingWorx&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thingworx Versions in use are 8.4 and 8.5.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;var params = {
	url: "https://&amp;lt;URL to JSON&amp;gt;" /* STRING */,
};

// result: JSON
var jsonData = Resources["ContentLoaderFunctions"].GetJSON(params);
// Function gives back a string-&amp;gt; toJSON only works with Infotable
jsonData = jsonData.ToJSON();
// lenght is only possible with actual JSON Object
logger.warn(jsonData.items.length);
var result = jsonData;
// TO DO create Infotable and change result to Info Table
/*
var dparams = {
	infoTableName : "InfoTable",
	dataShapeName : "LiveData"
};
// CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(AlertEvent)
var result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(dparams);
*/&lt;/LI-CODE&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;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My major question is what does the GETJSON function give back?&lt;/P&gt;
&lt;P&gt;My goal is to iterate through the JSON and create an InfoTable for later displaying KPIs in a Dashboard.&lt;/P&gt;
&lt;P&gt;Live Data from the Datasource&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jul 2020 07:10:32 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/GetJSON-from-external-source-and-map-it-to-a-info-table/m-p/675013#M46250</guid>
      <dc:creator>otluk</dc:creator>
      <dc:date>2020-07-02T07:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: GetJSON from external source and map it to a info table</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/GetJSON-from-external-source-and-map-it-to-a-info-table/m-p/675308#M46284</link>
      <description>&lt;P&gt;Resources["ContentLoaderFunctions"].GetJSON returns a JSON-Object so you don't need to convert it with ToJSON(). You can use this JSON-object like every other JSON-object. You can iterate through JSON as well as iterate through a info table.&lt;/P&gt;
&lt;P&gt;I think it makes sense to see what your JSON object looks like:&lt;/P&gt;
&lt;P&gt;logger.debug("jsonData: " + JSON.stringify(jsonData))&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jul 2020 11:48:33 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/GetJSON-from-external-source-and-map-it-to-a-info-table/m-p/675308#M46284</guid>
      <dc:creator>drichter</dc:creator>
      <dc:date>2020-07-02T11:48:33Z</dc:date>
    </item>
  </channel>
</rss>

