This is my code.
public static List<MyList> GetConfigurationJson()
{
List<MyList> Informations = new List<MyList>();
MyList CustomerLog = new MyList
{
ChannelName = "HR",
SubscriptionKey = "001",
Tenant = new Tenant()
{
CustomerId = "2001",
TenantId = "2551",
TenantName = "Hello"
}
};
Informations.Add(CustomerLog);
return Informations;
}
My output is like this.
[
{
"channelName": "HR",
"subscriptionKey": "001",
"tenant": {
"customerId": "dhh-e98391962001",
"tenantId": "391962551",
"tenantName": "dffg.com"
}
}
]
I want to remove this square brackets from here. I tried to convert this to Json. But I need output as below format for swagger.
CodePudding user response:
Seems like you want to return the Channel Object instead of a List. Try this:
public static Channel GetConfigurationJson()
{
MyList CustomerLog = new MyList
{
ChannelName = "HR",
SubscriptionKey = "001"
Tenant = new Tenant()
{
CustomerId = "2001",
TenantId = "2551",
TenantName = "Hello"
}
}
return CustomerLog;
}