You need to return an anonymous object that is serialized to JSON

DRAG DROP
You are developing an ASP.NET Web API action method.
The action method must return the following JSON in the message body.
{” Name “:” Fabrikam”, “Vendor Id”: 9823, “Items”: [“Apples”, “Oranges”] }
You need to return an anonymous object that is serialized to JSON.
What should you do? (To answer, drag the appropriate code segments to the correct location or
locations in the answer area. Each code segment may be used once, more than once, or not at all. You
may need to drag the split bar between panes or scroll to view content.

DRAG DROP
You are developing an ASP.NET Web API action method.
The action method must return the following JSON in the message body.
{” Name “:” Fabrikam”, “Vendor Id”: 9823, “Items”: [“Apples”, “Oranges”] }
You need to return an anonymous object that is serialized to JSON.
What should you do? (To answer, drag the appropriate code segments to the correct location or
locations in the answer area. Each code segment may be used once, more than once, or not at all. You
may need to drag the split bar between panes or scroll to view content.

Answer: See the explanation

Explanation:
Box 1: return new List<string>
Box 2: “Fabrikam”, VendorNumber=9823,
Box 3: new list<string>{“Apples”, “oranges”}



Leave a Reply 7

Your email address will not be published. Required fields are marked *

fifteen − thirteen =


t

t

box 1 should be: return new

Miguel Costa

Miguel Costa

I agree

Jeroen Vantroyen

Jeroen Vantroyen

Agree

nex-54

nex-54

“Vendor Id”, not “VendorNumber”

Jeroen Vantroyen

Jeroen Vantroyen

Good catch, but we can assume typo, otherwise none of the answers is correct.