DEV Community

muhasinnk
muhasinnk

Posted on

Is it Possible to Get this Model Json Result From API Response

Is it Possible to Get this Model Json Result From API Response

{
"controlname1":"descriptonText1",
"controlname2":"descriptionText2",
"controlname3":"descriptionText3"
}

so for getting this result in json , how to maintain the c# class structure and how to loop in the same

Top comments (3)

Collapse
 
coins5 profile image
Marlon Colca

Hi! check out quicktype, I hope you find it useful app.quicktype.io/

namespace QuickType
{
using System;
using System.Collections.Generic;

using System.Globalization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

public partial class Temperatures
{
    [JsonProperty("controlname1")]
    public string Controlname1 { get; set; }

    [JsonProperty("controlname2")]
    public string Controlname2 { get; set; }

    [JsonProperty("controlname3")]
    public string Controlname3 { get; set; }
}
Enter fullscreen mode Exit fullscreen mode

}

Collapse
 
muhasinnk profile image
muhasinnk

thanks for the updates,
but if the values to '10 Times' how should we make up th class structure,
some time it maybe one its depends upon the data record from database,

so in a single "Controlname" name filed how should loop ?
i think i got my question.

Collapse
 
muhasinnk profile image
muhasinnk

pls responsd if any member knows it