How to access Json object property?

Asked

Viewed 757 times

1

I am receiving via Ajax a Json object, and would like to turn it into a C# object and access its properties. How can I do that? inserir a descrição da imagem aqui


I ended up reversing the name of the variables (objeto, itens), the first are the items, and the second the objects themselves.

1 answer

1


With the help of link posted by Marciano.Andrade in the comment of my question, I arrived at the solution.
The point is that I am receiving a list of objects, so just create an array of such objects.
Everything worked out with the following line:

Aluno[] aluno = new JavaScriptSerializer().Deserialize<Aluno[]>(models);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.