Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Azure by (45.3k points)

Basically, I'm receiving an output like this from my azure ws output:

{

    'Results': {

        'WSOutput': {

            'type': 'table',

            'value': {

                'ColumnNames': ['ID', 'Start', 'Ask', 'Not', 'Passed', 'Suggest'],

                'ColumnTypes': ['Int32', 'Int32', 'Int32', 'Double', 'Int64', 'Int32'],

                'Values': [['13256025', '25000', '19000', '0.35', '1', '25000']]

            }

        }

    }

}

The string, as you can see, has the info to create a datatable object. Now, I can't seem to find an easy way to cast it to an actual datatable POCO. I'm able to manually code a parser with Newtonsoft.Json.Linq but there has to be an easier way.

Does anybody know how? I can't seem to find anything on the net.

1 Answer

0 votes
by (16.8k points)

Yes, there is a open source online generator, check this source: http://jsonutils.com/

Try to copy paste this, it should work:

public class Value

    {

        public IList<string> ColumnNames { get; set; }

        public IList<string> ColumnTypes { get; set; }

        public IList<IList<string>> Values { get; set; }

    }

    public class WSOutput

    {

        public string type { get; set; }

        public Value value { get; set; }

    }

    public class Results

    {

        public WSOutput WSOutput { get; set; }

    }

    public class Example

    {

        public Results Results { get; set; }

    }

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...