Click here to Skip to main content
15,887,027 members
Home / Discussions / C#
   

C#

 
AnswerRe: a simpler binding technique for WinForms ? request for code review Pin
Gerry Schmitz2-Mar-18 6:20
mveGerry Schmitz2-Mar-18 6:20 
GeneralRe: a simpler binding technique for WinForms ? request for code review Pin
BillWoodruff2-Mar-18 6:27
professionalBillWoodruff2-Mar-18 6:27 
GeneralRe: a simpler binding technique for WinForms ? request for code review Pin
Gerry Schmitz2-Mar-18 6:43
mveGerry Schmitz2-Mar-18 6:43 
QuestionNeed to export data from sql server to excel sheet in windows application Pin
Shankar M28-Feb-18 23:36
Shankar M28-Feb-18 23:36 
AnswerRe: Need to export data from sql server to excel sheet in windows application Pin
Richard MacCutchan28-Feb-18 23:56
mveRichard MacCutchan28-Feb-18 23:56 
GeneralRe: Need to export data from sql server to excel sheet in windows application Pin
Shankar M1-Mar-18 0:07
Shankar M1-Mar-18 0:07 
AnswerRe: Need to export data from sql server to excel sheet in windows application Pin
Gerry Schmitz1-Mar-18 8:01
mveGerry Schmitz1-Mar-18 8:01 
QuestionHow can i get the json data in to c# object Pin
Member 1370260728-Feb-18 18:20
Member 1370260728-Feb-18 18:20 
Below is my class for the json output:

class PwdResetRequest
    {
        public class TopScoringIntent
        {
            public string intent { get; set; }
            public double score { get; set; }
        }

        public class Intent
        {
            public string intent { get; set; }
            public double score { get; set; }
        }

        public class Resolution
        {
            public string value { get; set; }
        }

        public class Entity
        {
            public string entity { get; set; }
            public string type { get; set; }
            public int startIndex { get; set; }
            public int endIndex { get; set; }
            public Resolution resolution { get; set; }
        }

        public class RootObject
        {
            public string query { get; set; }
            public TopScoringIntent topScoringIntent { get; set; }
            public List<Intent> intents { get; set; }
            public List<Entity> entities { get; set; }
        }

    }
Luis Return result:

   {
  "query": "create a new password for sjao9841@demo.com",
  "topScoringIntent": {
    "intent": "ResetLANIDpassword",
    "score": 0.9956063
  },
  "intents": [
    {
      "intent": "ResetLANIDpassword",
      "score": 0.9956063
    },
    {
      "intent": "None",
      "score": 0.179328963
    }
  ],
  "entities": [
    {
      "entity": "sjao9841@demo.com",
      "type": "builtin.email",
      "startIndex": 26,
      "endIndex": 47
    }
  ]
}
I have developed the below code for getting the data from the json.

    var uri = 
    "https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/" + 
    luisAppId + "?" + queryString;
    var response = await client.GetAsync(uri);

    var strResponseContent = await response.Content.ReadAsStringAsync();

    var json = await response.Content.ReadAsStringAsync();

    var token = JObject.Parse(json).SelectToken("entities");


    foreach (var item in token)
    {
        var request = item.ToObject<Entity>();
    } 

    // Display the JSON result from LUIS
    Console.WriteLine(strResponseContent.ToString());
}
And I only want the data from the "TopScoringIntent". How can I get that using C#? Below is the code that I tried but nothing came out: Message=Error reading JObject from JsonReader. Path '', line 0, position 0. Source=Newtonsoft.Json

AnswerRe: How can i get the json data in to c# object Pin
Eddy Vluggen1-Mar-18 9:33
professionalEddy Vluggen1-Mar-18 9:33 
QuestionHow to open P to P Conference system in VB community? Pin
Member 1370237428-Feb-18 14:42
Member 1370237428-Feb-18 14:42 
AnswerRe: How to open P to P Conference system in VB community? Pin
Dave Kreskowiak28-Feb-18 15:27
mveDave Kreskowiak28-Feb-18 15:27 
QuestionRe: How to open P to P Conference system in VB community? Pin
Member 1370237428-Feb-18 16:06
Member 1370237428-Feb-18 16:06 
AnswerRe: How to open P to P Conference system in VB community? Pin
Dave Kreskowiak28-Feb-18 17:32
mveDave Kreskowiak28-Feb-18 17:32 
QuestionHow to Create Asynchronous Web Service in MVC C# Pin
Renuka Garg Phatak28-Feb-18 8:57
Renuka Garg Phatak28-Feb-18 8:57 
AnswerRe: How to Create Asynchronous Web Service in MVC C# Pin
Gerry Schmitz28-Feb-18 10:40
mveGerry Schmitz28-Feb-18 10:40 
QuestionRe: How to Create Asynchronous Web Service in MVC C# Pin
Eddy Vluggen1-Mar-18 9:34
professionalEddy Vluggen1-Mar-18 9:34 
AnswerRe: How to Create Asynchronous Web Service in MVC C# Pin
Gerry Schmitz1-Mar-18 10:07
mveGerry Schmitz1-Mar-18 10:07 
AnswerRe: How to Create Asynchronous Web Service in MVC C# Pin
Gerry Schmitz1-Mar-18 10:19
mveGerry Schmitz1-Mar-18 10:19 
GeneralRe: How to Create Asynchronous Web Service in MVC C# Pin
Renuka Garg Phatak2-Mar-18 4:04
Renuka Garg Phatak2-Mar-18 4:04 
AnswerRe: How to Create Asynchronous Web Service in MVC C# Pin
MadMyche5-Mar-18 7:15
professionalMadMyche5-Mar-18 7:15 
GeneralRe: How to Create Asynchronous Web Service in MVC C# Pin
Renuka Garg Phatak6-Mar-18 2:55
Renuka Garg Phatak6-Mar-18 2:55 
QuestionCrystal report page footer problem Pin
Member 1257026328-Feb-18 1:32
Member 1257026328-Feb-18 1:32 
AnswerRe: Crystal report page footer problem Pin
Eddy Vluggen28-Feb-18 1:36
professionalEddy Vluggen28-Feb-18 1:36 
AnswerRe: Crystal report page footer problem Pin
phil.o28-Feb-18 2:54
professionalphil.o28-Feb-18 2:54 
AnswerRe: Crystal report page footer problem Pin
OriginalGriff28-Feb-18 4:06
mveOriginalGriff28-Feb-18 4:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.