1

I have the following JSon string returned from a service:

{
    "products": {
        "product_1": [
            "this is description for product 1"
        ],
        "product_2": [
            "this is description for product 2"
        ]
    }
}

What I would like to do is convert it to a List of Product Class in c#. My Product class looks like this

public class Product
{
    public String Name{ get; set; }

    public String Description{ get; set; }
}

So for example above, "product_1" will be mapped to the Name property and "this is description for product 1" needs to be mapped to the Description property of the product class. Based on the Json, I would like to return a List.

Can anyone please help me out how can I achieve that using Newtonsoft.Json?

Thanks

3

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.