Readdy Write  
0,00 €
Your View Money
Views: Count
Self 20% 0
Your Content 60% 0

Users by Links 0
u1*(Content+Views) 10% 0
Follow-Follower 0
s2*(Income) 5% 0

Count
Followers 0
Login Register as User

System.Exception HRESULT: 0x83750007 bei Json Parse

26.06.2018 (👁6323)



System.Exception

  HResult=0x83750007

  Message=Ungültige JSON-Zeichenfolge. (Exception from HRESULT: 0x83750007)

  Source=<Cannot evaluate the exception source>

  StackTrace:

<Cannot evaluate the exception stack trace>

 

Beim UWP C# Code

public async void read_API_Data()

{

    //---------------< read_API_Data() >---------------

 

    string sURL = "http://localhost:51198/api/projects";

    HttpClient client = new HttpClient();

    string sResponse = await client.GetStringAsync(sURL);

 

    //*ERROR

    JsonObject jsonObject = JsonObject.Parse(sResponse);

    //---------------</ read_API_Data() >---------------

}

 

 

Lösung:

Wenn in der Asp.Net Core Api Anwendung eine Liste als Json Ausgabe ausgeben wird, dann erscheint der Fehler 0x83750007

Man muss deshalb eine Json-Liste im Client in eine JsonArray einlesen und dann durch die einzelnen Zeilen in einem Loop gehen

JsonArray jsonArray = JsonArray.Parse(sResponse);

            foreach (var jsonRow in jsonArray)

            {

                //----< json Row >----

                JsonObject jsonObject=jsonRow.GetObject();

 ..

            {

 

 

 

 

public async void read_API_Data()

        {

            //---------------< read_API_Data() >---------------

            //< read webApi >

            string sURL = "http://localhost:51198/api/projects";

            HttpClient client = new HttpClient();

            string sResponse = await client.GetStringAsync(sURL);

            //</ read webApi >

 

            //< get Json values >

            JsonArray jsonArray = JsonArray.Parse(sResponse);

            foreach (var jsonRow in jsonArray)

            {

                //----< json Row >----

                JsonObject jsonObject=jsonRow.GetObject();

 

                //< values >

                string IDProject= jsonObject["idProject"].ToString();

                string Title = jsonObject["title"].ToString();

                string Text = jsonObject["text"].ToString();

                string dtEdit = jsonObject["dtEdit"].ToString();

                //</ values >

 

                tbxResults.Text += Environment.NewLine + "-------";

                tbxResults.Text += Environment.NewLine + "idProject=" + IDProject;

                tbxResults.Text += Environment.NewLine + "Title=" + Title;

                tbxResults.Text += Environment.NewLine + "Text=" + Text;

                tbxResults.Text += Environment.NewLine + "dtEdit=" + dtEdit;

                //----</ json Row >----

            }

 

            //</ get Json values >

            //---------------</ read_API_Data() >---------------

        }