Parse a graph url from a string

Viewed 32

I have the following string:

[{ "sources": ["https://graph.microsoft.com/v1.0/users?$count=true&$filter=startswith(displayName,'ConfRoom')"]}]

From this string, I need to parse the url:

https://graph.microsoft.com/v1.0/users?$count=true&$filter=startswith(displayName,'ConfRoom')

This is what I tried so far:

string query = "[{ "sources": ["https://graph.microsoft.com/v1.0/users?$count=true&$filter=startswith(displayName,'ConfRoom')"]}]"
var queryParts = JArray.Parse(query);
var currentPart = queryParts[0];
var url = currentPart.Value<JArray>("sources");
var urlAsString = Convert.ToString(url);

On running this, I see url as:

[ "https://graph.microsoft.com/v1.0/users?$count=true&$filter=startswith(displayName,'ConfRoom')" ]

How do I update the code to get the url as:

https://graph.microsoft.com/v1.0/users?$count=true&$filter=startswith(displayName,'ConfRoom')

0 Answers
Related