<?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: How do I remove datashape field from below JSON output? in ThingWorx Developers</title>
    <link>https://community.ptc.com/t5/ThingWorx-Developers/How-do-I-remove-datashape-field-from-below-JSON-output/m-p/712378#M50489</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.ptc.com/t5/user/viewprofilepage/user-id/379666"&gt;@KN_9774047&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I gave the code a try in 9.0.3 and able to get output without datashape. Sharing my script for reference:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;P&gt;&lt;FONT face="batang,apple gothic"&gt;var params = {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;infoTableName: undefined /* STRING */,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;dataShapeName: "DS" /* DATASHAPENAME */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;};&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="batang,apple gothic"&gt;// result: INFOTABLE&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;var result1= Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="batang,apple gothic"&gt;var newEntry = new Object();&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;newEntry.name = "test1"; // STRING - isPrimaryKey = true&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;newEntry.value = "test 1"; // STRING - isPrimaryKey = true&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;result1.AddRow(newEntry);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="batang,apple gothic"&gt;newEntry.name = "test2"; // STRING - isPrimaryKey = true&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;newEntry.value = "test 2"; // STRING - isPrimaryKey = true&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;result1.AddRow(newEntry);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="batang,apple gothic"&gt;newEntry.name = "test3"; // STRING - isPrimaryKey = true&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;newEntry.value = "test 3"; // STRING - isPrimaryKey = true&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;result1.AddRow(newEntry);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="batang,apple gothic"&gt;var param = {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;table: result1 /* INFOTABLE */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;};&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;var result = Resources["InfoTableFunctions"].ToJSON(param);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;result.array = result.rows;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;delete result.rows;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;delete result.dataShape;&lt;/FONT&gt;&lt;/P&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;JSON Output:&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;"array": [&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;"name": "test1",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;"value": "test 1"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;},&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;"name": "test2",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;"value": "test 2"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;},&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;"name": "test3",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;"value": "test 3"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;}&lt;/FONT&gt;&lt;/LI-SPOILER&gt;
&lt;P&gt;Could you attach your service code here if still not getting output without DataShape.&lt;/P&gt;</description>
    <pubDate>Thu, 11 Feb 2021 10:26:19 GMT</pubDate>
    <dc:creator>suverma</dc:creator>
    <dc:date>2021-02-11T10:26:19Z</dc:date>
    <item>
      <title>How do I remove datashape field from below JSON output?</title>
      <link>https://community.ptc.com/t5/ThingWorx-Developers/How-do-I-remove-datashape-field-from-below-JSON-output/m-p/712326#M50480</link>
      <description>&lt;P&gt;{&lt;BR /&gt;"data": [&lt;BR /&gt;{&lt;BR /&gt;"usageId": "50030540014333322800000050",&lt;BR /&gt;"assetFound": true,&lt;BR /&gt;"compartments": {&lt;BR /&gt;"rows": [&lt;BR /&gt;{&lt;BR /&gt;"compartmentId": "50030540014333322800000052",&lt;BR /&gt;"observableProperties": {&lt;BR /&gt;"gatewayLocationDescription": "Ireland",&lt;BR /&gt;"temperature": 6,&lt;BR /&gt;"timestamp": 1612393200000&lt;BR /&gt;},&lt;BR /&gt;"compartmentUsage": {&lt;BR /&gt;"compartmentState": "Inuse",&lt;BR /&gt;"minTemperatureThreshold": 2.2&lt;BR /&gt;}&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;"compartmentId": "50030540014333322800000051",&lt;BR /&gt;"observableProperties": {&lt;BR /&gt;"gatewayLocationDescription": "Belgium",&lt;BR /&gt;"temperature": 2,&lt;BR /&gt;"timestamp": 1612220400000&lt;BR /&gt;},&lt;BR /&gt;"compartmentUsage": {&lt;BR /&gt;"compartmentState": "Idle"&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;],&lt;BR /&gt;"dataShape": {&lt;BR /&gt;"fieldDefinitions": {&lt;BR /&gt;"compartmentId": {&lt;BR /&gt;"name": "compartmentId",&lt;BR /&gt;"aspects": {&lt;BR /&gt;"isPrimaryKey": false&lt;BR /&gt;},&lt;BR /&gt;"description": "",&lt;BR /&gt;"baseType": "STRING",&lt;BR /&gt;"ordinal": 1&lt;BR /&gt;},&lt;BR /&gt;"observableProperties": {&lt;BR /&gt;"name": "observableProperties",&lt;BR /&gt;"aspects": {&lt;BR /&gt;"isPrimaryKey": false&lt;BR /&gt;},&lt;BR /&gt;"description": "",&lt;BR /&gt;"baseType": "JSON",&lt;BR /&gt;"ordinal": 3&lt;BR /&gt;},&lt;BR /&gt;"compartmentUsage": {&lt;BR /&gt;"name": "compartmentUsage",&lt;BR /&gt;"aspects": {&lt;BR /&gt;"isPrimaryKey": false&lt;BR /&gt;},&lt;BR /&gt;"description": "",&lt;BR /&gt;"baseType": "JSON",&lt;BR /&gt;"ordinal": 2&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;],&lt;BR /&gt;"message": "Information found",&lt;BR /&gt;"status": "Success"&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2021 04:37:39 GMT</pubDate>
      <guid>https://community.ptc.com/t5/ThingWorx-Developers/How-do-I-remove-datashape-field-from-below-JSON-output/m-p/712326#M50480</guid>
      <dc:creator>KN_9774047</dc:creator>
      <dc:date>2021-02-11T04:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do I remove datashape field from below JSON output?</title>
      <link>https://community.ptc.com/t5/ThingWorx-Developers/How-do-I-remove-datashape-field-from-below-JSON-output/m-p/712349#M50483</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.ptc.com/t5/user/viewprofilepage/user-id/379666"&gt;@KN_9774047&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can refer to below link to get rid of datashape fields coming along in your JSON output:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.ptc.com/t5/ThingWorx-Developers/Infotable-to-Json-gives-datashape-information/td-p/669637" target="_self"&gt;Remove DataShapes from JSON Output&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do revert for more queries.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Sudeepta&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2021 07:42:19 GMT</pubDate>
      <guid>https://community.ptc.com/t5/ThingWorx-Developers/How-do-I-remove-datashape-field-from-below-JSON-output/m-p/712349#M50483</guid>
      <dc:creator>suverma</dc:creator>
      <dc:date>2021-02-11T07:42:19Z</dc:date>
    </item>
    <item>
      <title>Re: How do I remove datashape field from below JSON output?</title>
      <link>https://community.ptc.com/t5/ThingWorx-Developers/How-do-I-remove-datashape-field-from-below-JSON-output/m-p/712350#M50484</link>
      <description>&lt;P&gt;Tried that way in Thingworx 9.0.3 but not working out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;datShape field is still showing up in the output&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2021 07:50:08 GMT</pubDate>
      <guid>https://community.ptc.com/t5/ThingWorx-Developers/How-do-I-remove-datashape-field-from-below-JSON-output/m-p/712350#M50484</guid>
      <dc:creator>KN_9774047</dc:creator>
      <dc:date>2021-02-11T07:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do I remove datashape field from below JSON output?</title>
      <link>https://community.ptc.com/t5/ThingWorx-Developers/How-do-I-remove-datashape-field-from-below-JSON-output/m-p/712378#M50489</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.ptc.com/t5/user/viewprofilepage/user-id/379666"&gt;@KN_9774047&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I gave the code a try in 9.0.3 and able to get output without datashape. Sharing my script for reference:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;P&gt;&lt;FONT face="batang,apple gothic"&gt;var params = {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;infoTableName: undefined /* STRING */,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;dataShapeName: "DS" /* DATASHAPENAME */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;};&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="batang,apple gothic"&gt;// result: INFOTABLE&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;var result1= Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="batang,apple gothic"&gt;var newEntry = new Object();&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;newEntry.name = "test1"; // STRING - isPrimaryKey = true&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;newEntry.value = "test 1"; // STRING - isPrimaryKey = true&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;result1.AddRow(newEntry);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="batang,apple gothic"&gt;newEntry.name = "test2"; // STRING - isPrimaryKey = true&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;newEntry.value = "test 2"; // STRING - isPrimaryKey = true&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;result1.AddRow(newEntry);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="batang,apple gothic"&gt;newEntry.name = "test3"; // STRING - isPrimaryKey = true&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;newEntry.value = "test 3"; // STRING - isPrimaryKey = true&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;result1.AddRow(newEntry);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="batang,apple gothic"&gt;var param = {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;table: result1 /* INFOTABLE */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;};&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;var result = Resources["InfoTableFunctions"].ToJSON(param);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;result.array = result.rows;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;delete result.rows;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;delete result.dataShape;&lt;/FONT&gt;&lt;/P&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;JSON Output:&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;"array": [&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;"name": "test1",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;"value": "test 1"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;},&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;"name": "test2",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;"value": "test 2"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;},&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;"name": "test3",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;"value": "test 3"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="batang,apple gothic"&gt;}&lt;/FONT&gt;&lt;/LI-SPOILER&gt;
&lt;P&gt;Could you attach your service code here if still not getting output without DataShape.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2021 10:26:19 GMT</pubDate>
      <guid>https://community.ptc.com/t5/ThingWorx-Developers/How-do-I-remove-datashape-field-from-below-JSON-output/m-p/712378#M50489</guid>
      <dc:creator>suverma</dc:creator>
      <dc:date>2021-02-11T10:26:19Z</dc:date>
    </item>
    <item>
      <title>Re: How do I remove datashape field from below JSON output?</title>
      <link>https://community.ptc.com/t5/ThingWorx-Developers/How-do-I-remove-datashape-field-from-below-JSON-output/m-p/712383#M50490</link>
      <description>&lt;P&gt;I am not allowed share the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But mine is a nested JSON.What you created is a straight forward one. It's not working with my output(nested)&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2021 10:47:15 GMT</pubDate>
      <guid>https://community.ptc.com/t5/ThingWorx-Developers/How-do-I-remove-datashape-field-from-below-JSON-output/m-p/712383#M50490</guid>
      <dc:creator>KN_9774047</dc:creator>
      <dc:date>2021-02-11T10:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: How do I remove datashape field from below JSON output?</title>
      <link>https://community.ptc.com/t5/ThingWorx-Developers/How-do-I-remove-datashape-field-from-below-JSON-output/m-p/712976#M50547</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.ptc.com/t5/user/viewprofilepage/user-id/379666"&gt;@KN_9774047&lt;/a&gt;.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;If you would like, we can open a case for further review of the problem.&amp;nbsp; I will be happy to open the case on your behalf.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Regards.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;--Sharon&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 14:49:23 GMT</pubDate>
      <guid>https://community.ptc.com/t5/ThingWorx-Developers/How-do-I-remove-datashape-field-from-below-JSON-output/m-p/712976#M50547</guid>
      <dc:creator>slangley</dc:creator>
      <dc:date>2021-02-15T14:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do I remove datashape field from below JSON output?</title>
      <link>https://community.ptc.com/t5/ThingWorx-Developers/How-do-I-remove-datashape-field-from-below-JSON-output/m-p/903546#M63905</link>
      <description>&lt;P&gt;Thank you. It's help me!&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 20:02:28 GMT</pubDate>
      <guid>https://community.ptc.com/t5/ThingWorx-Developers/How-do-I-remove-datashape-field-from-below-JSON-output/m-p/903546#M63905</guid>
      <dc:creator>FabioValente</dc:creator>
      <dc:date>2023-09-29T20:02:28Z</dc:date>
    </item>
  </channel>
</rss>

