Serialize a Json Matrix ASP Entity

0

Someone who can help me with the following error:

It turns out that I created an API in ASP.net with the help of visual studio 2017 and entity framework, I did everything with the help of the tools since I have several related tables in SQL server.

I made my apis and I can consume them locally without any problem, I made an application always in asp with a crud with that api and everything works fine.

The problem is when uploading them to Azure, it throws me the following error:

  

{"$ id": "1", "Message": "An error has occurred."}

I looked for information about that and from the thousands of ways that I could not solve it. I tried to consume the api from my local application always with the api in the cloud and I get another error:

  

To fix this error either change the JSON to a JSON array (e.g.   [1,2,3]) or change the deserialized type so that it is a normal .NET   type

From this error I found more information, apparently I am trying to read a Json Object but the api returns a Json array and I need to deserialize it or something like that. I also eliminated all my data from the database, leaving only the empty tables and then I do not get that error, so according to my observation it is that when putting data into the tables, for reasons of the references to the other tables that is generated .

My problem is that all the solutions to that error that I found in this forum and many more, is that everyone has created their models and controllers from scratch each with their own code and I generated everything through the visual study.

If someone could tell me how I could fix it adapted to what I am working on or at least guide me what files to modify, according to the solution of others I should do something like the following:

var objResponse1 = 
JsonConvert.DeserializeObject<List<RetrieveMultipleResponse>>(JsonStr);

Others like that

var des = (MyClass)Newtonsoft.Json.JsonConvert.DeserializeObject(response, typeof(MyClass));return des.data.Count.ToString();

In the end everyone solves it in a similar way but I do not understand where to put that inside my code since I did not create my classes for reasons of time.

    
asked by Salva Valladares 12.09.2018 в 20:25
source

0 answers