Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Possible to hide Key and Value display in Json?

$
0
0

Hi folks,

Here is my code:

List<KeyValuePair<string, string>> attributeList = new List<KeyValuePair<string, string>>();

while (ienum.MoveNext())
{
    string attributeName = attribute.Name;
    string attributeVal = attribute.StringValue;

	// rest omitted

    if (attributeName == "sAMAccountName" || attributeName == "mail" || attributeName == "displayName" || attributeName == "telephoneNumber" || attributeName == "mobile")
    {
        attributeList.Add(new KeyValuePair<string, string>(attributeName, attributeVal));

    }
}
return Ok(attributeList);

Output:

It seems ok but i want to display output like:

[
{"displayName" : "*****"
},
{"telephoneNumber":"*****"
},
{"mobile": "******"
},
.....
//Rest Omitted
.....
]

Is It possible to hide key and value? If yes then how?

I am waiting for your response.

Thanks in advance


 


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>