1 Reply Latest reply on Aug 31, 2016 5:34 PM by wposner-2 RSS
    wposner-2 Apprentice

    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?