0

In my ASP.NET Web API app, I have a query that is as such:

var cars = db.Cars.Where(x => x.budget < budget).GroupBy(Cars => Cars.carTypeID).ToList();

Now that I have the list cars that should be full of car objects grouped by carTypeID (This is only a test, I know it's impractical), how do I build the car objects on the client side once I return a response with the list?

EDIT: Results are returned in JSON format fyi

3
  • Do you receive a list of cars in JSON format on the client side? Commented Mar 13, 2018 at 12:38
  • Yes sorry, forgot to add that the results are sent in JSON format Commented Mar 13, 2018 at 12:48
  • Can you share sample JSON? Commented Mar 13, 2018 at 12:57

1 Answer 1

1

var javascriptObject = JSON.parse(jsonData);

Sign up to request clarification or add additional context in comments.

2 Comments

Sorry but then what since that is stored in one variable rather than multiple variables to represent the multiple objects in the list
you can access to each one: javascriptObject[0], javascriptObject[1],javascriptObject[2], etc...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.