cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Export Custom Data Structure as JSON

wposner-2
14-Alexandrite

Export Custom Data Structure as JSON

I believe the only way to do this is with a custom extension, but wanted to ask the collective before starting down that path.  I have a data structure being stored in a DataTable.  I need to export just my DataShape properties to JSON format.  I tried the DataExporter button and while it did give me a JSON dataset, it included entirely too much information.

My DataShape has a few more properties than what I need in my export but basically it has a name property and two infotable properties (dataFields and allowedOperators) .  I need my export to look as follows:

{

"id" : 1,

"name": "protocol 1",

"connections":

{

"datafields":  [

[

{"name": "Charter Med Lot No" },

{"name":"Donation No-Pooling Bag"},

{"name":"Donation No-Comp1"},

{"name":"Product Code-Comp1"}

   ],

[

{"name":"Donation No-Comp2"},

   {"name":"Product Code-Comp2"}

],

[

{"name":"Donation No-Comp3"},

             {"name":"Product Code-Comp3"}

]

],

"allowedoperators": ["1234", "6789"]

}

}

I can write the javascript to parse my DT and create a string in the above format, so my specific question is if I have the above passed to a service result as a string, is there an out of the box Thingworx service I can call to write that string to a file repository?

ACCEPTED SOLUTION

Accepted Solutions
wposner-2
14-Alexandrite
(To:wposner-2)

Found the answer by creating a new Thing that implements a FileRepository Thing Template.  All the services I need were in the thing.

View solution in original post

1 REPLY 1
wposner-2
14-Alexandrite
(To:wposner-2)

Found the answer by creating a new Thing that implements a FileRepository Thing Template.  All the services I need were in the thing.

Announcements


Top Tags