I have some stream data from that i want to retrieve
"estimatedResultCount":"399" from this below data
how to get 399 value from this approach
parsing the JSON -> responseData -> cursor -> estimatedResultCount will get you backing count.
{
"responseData": {
"results": [
{
"GsearchResultClass": "GwebSearch",
"unescapedUrl": "http://www.homeocare.in/",
"url": "http://www.homeocare.in/",
"visibleUrl": "www.homeocare.in",
"cacheUrl": "http://www.google.com/search?q=cache:E7xF9dtFWgIJ:www.homeocare.in",
"title": "Homeopathy Clinics in Hyderabad - Homeopathy Treatment",
"titleNoFormatting": "Homeopathy Clinics in Hyderabad - Homeopathy Treatment",
"content": "Homeocare International - World Class Homeopathy Clinic in India provides \ninformation on causes, symptoms, and Homeopathy treatment of various \ndiseases."
},
{
"GsearchResultClass": "GwebSearch",
"unescapedUrl": "http://www.homeocare.in/contactus.html",
"url": "http://www.homeocare.in/contactus.html",
"visibleUrl": "www.homeocare.in",
"cacheUrl": "http://www.google.com/search?q=cache:zrjNDKonZY0J:www.homeocare.in",
"title": "Homeocare International | Contact Us",
"titleNoFormatting": "Homeocare International | Contact Us",
"content": "To get best Homeopathy treatment Contact Homeocare International through \nphone or fill contact form. We have branches all over South India."
},
{
"GsearchResultClass": "GwebSearch",
"unescapedUrl": "http://www.homeocare.in/testimonials.html",
"url": "http://www.homeocare.in/testimonials.html",
"visibleUrl": "www.homeocare.in",
"cacheUrl": "http://www.google.com/search?q=cache:oPJKzW6sHOkJ:www.homeocare.in",
"title": "Homeocare International Reviews / Testimonials",
"titleNoFormatting": "Homeocare International Reviews / Testimonials",
"content": "Homeocare International Reviews / Testimonials for Happy Patient. We pride \nourselves on excellent service, and our reviews show it!"
},
{
"GsearchResultClass": "GwebSearch",
"unescapedUrl": "http://www.homeocare.in/arthritis.html",
"url": "http://www.homeocare.in/arthritis.html",
"visibleUrl": "www.homeocare.in",
"cacheUrl": "http://www.google.com/search?q=cache:gqHnM_Tg0hcJ:www.homeocare.in",
"title": "Homeopathy Treatment for Arthritis | Arthritis Treatment",
"titleNoFormatting": "Homeopathy Treatment for Arthritis | Arthritis Treatment",
"content": "Get Homeopathy Treatment for arthritis and rheumatoid arthritis at Homeocare \nInternational provides safe and effective remedies with no side effects."
}
],
"cursor": {
"resultCount": "399",
"pages": [
{
"start": "0",
"label": 1
},
{
"start": "4",
"label": 2
},
{
"start": "8",
"label": 3
},
{
"start": "12",
"label": 4
},
{
"start": "16",
"label": 5
},
{
"start": "20",
"label": 6
},
{
"start": "24",
"label": 7
},
{
"start": "28",
"label": 8
}
],
"estimatedResultCount": "399",
"currentPageIndex": 0,
"moreResultsUrl": "http://www.google.com/search?oe=utf8&ie=utf8&source=uds&start=0&hl=en&q=site:homeocare.in",
"searchResultTime": "0.09"
}
},
"responseDetails": null,
"responseStatus": 200
}
Code
string strurl = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=site:homeocare.in";
StreamReader stream = objm.URLServerRequest(strurl);
string myResponse = stream.ReadToEnd();
public StreamReader URLServerRequest(string url)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
StreamReader stream = new StreamReader(request.GetResponse().GetResponseStream());
return stream;
}
You can generate the class here http://json2csharp.com/, it's very easy.
Given that you succesfully download the json string, here's the code as a console application. It uses json.net (https://www.nuget.org/packages/Newtonsoft.Json/7.0.1-beta2)
class Program
{
static void Main(string[] args)
{
var json = #".... json string....";
var obj = JsonConvert.DeserializeObject<RootObject>(json);
Console.WriteLine(obj.responseData.cursor.estimatedResultCount)
;
Console.ReadLine();
}
}
public class Result
{
public string GsearchResultClass { get; set; }
public string unescapedUrl { get; set; }
public string url { get; set; }
public string visibleUrl { get; set; }
public string cacheUrl { get; set; }
public string title { get; set; }
public string titleNoFormatting { get; set; }
public string content { get; set; }
}
public class Page
{
public string start { get; set; }
public int label { get; set; }
}
public class Cursor
{
public string resultCount { get; set; }
public List<Page> pages { get; set; }
public string estimatedResultCount { get; set; }
public int currentPageIndex { get; set; }
public string moreResultsUrl { get; set; }
public string searchResultTime { get; set; }
}
public class ResponseData
{
public List<Result> results { get; set; }
public Cursor cursor { get; set; }
}
public class RootObject
{
public ResponseData responseData { get; set; }
public object responseDetails { get; set; }
public int responseStatus { get; set; }
}
Related
I am trying to deserialize a json response I get from a web call. I have it 90 percent figured out. The only part I am having a hard time figuring out is there are these json arrays which have data in them and each array name is unique using the email address. I have not been able to figure out how to turn the Email Arrays into 1. Dynamic and having it create many lists or just a couple depending on what comes back in the response and also dynamically naming the list arrays to put the data into the Records class.
As you can see in the Records class I need this to be more dynamic and flexible to receive any and all emails.
Below is the json:
{
"result": {
"records": {
"joeblow#gmail.com": [
{
"OrderId": "d9535109-d305-4584-a503-8194bbcfcff2",
"CompletedOrderId": "BCFCFF2",
"CustomerId": 1212,
"CompletedTime": "2020-10-26 13:32:02",
"Email": "joeblow#gmail.com",
"ShippingFirstName": "Joe",
"ShippingMiddleName": "",
"ShippingLastName": "Blow",
"LineItems": {
"tfl.es.bluray": { "qty": 1 },
"booklets.en.ebook": { "qty": 1 }
}
}
],
"cleob#hotmail.com": [
{
"OrderId": "7bf97b3a-bc46-411c-bc30-12563326dba0",
"CompletedOrderId": "326DBA0",
"CustomerId": 1212,
"CompletedTime": "2020-10-26 20:07:44",
"Email": "cleob#hotmail.com",
"ShippingFirstName": "Cleo",
"ShippingMiddleName": "",
"ShippingLastName": "Blue",
"LineItems": {
"tfl.es.bluray": { "qty": 1 },
"booklets.en.ebook": { "qty": 1 },
"aos.en.pb": { "qty": 1 },
"course-tos.en.olr": { "qty": 1 },
"pow-hsk-nofilm.en.combo": { "qty": 1 },
"course-organizing.en.olr": { "qty": 1 }
}
}
],
"johnd#gmail.com": [
{
"OrderId": "630f0dda-94c3-4b82-a070-2554004dce29",
"CompletedOrderId": "04DCE29",
"CustomerId": 12345,
"CompletedTime": "2020-10-25 21:52:04",
"Email": "johnd#gmail.com",
"ShippingFirstName": "John",
"ShippingMiddleName": "",
"ShippingLastName": "Doe",
"LineItems": {
"tfl.es.bluray": { "qty": 1 },
"booklets.en.ebook": { "qty": 1 },
"aos.en.pb": { "qty": 1 },
"course-tos.en.olr": { "qty": 1 },
"pow-hsk-nofilm.en.combo": { "qty": 1 },
"course-organizing.en.olr": { "qty": 1 },
"oak-2007.en.cd": { "qty": 1 }
}
}
]
},
"errors": [
{
"id": "bademailaddress-yahoo.com",
"message": "Email address 'bademailaddress-yahoo.com' is not a valid email address"
}
]
},
"jsonrpc": "2.0",
"id": 12345634523
}
And the classes I made for the json deserialization:
public partial class JsonEmailDeSerializer
{
[JsonProperty("result")]
public Result Result { get; set; }
[JsonProperty("jsonrpc")]
public string Jsonrpc { get; set; }
[JsonProperty("id")]
public long Id { get; set; }
}
public partial class Result
{
[JsonProperty("records")]
public Records Records { get; set; }
[JsonProperty("errors")]
public List<Error> Errors { get; set; }
}
public partial class Error
{
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("message")]
public string Message { get; set; }
}
public partial class Records
{
[JsonProperty("joeblow#gmail.com")]
public List<MailCom> JoeblowGmailCom { get; set; }
[JsonProperty("cleob#hotmail.com")]
public List<MailCom> CleobHotmailCom { get; set; }
[JsonProperty("johnd#gmail.com")]
public List<MailCom> JohndGmailCom { get; set; }
}
public partial class MailCom
{
[JsonProperty("OrderId")]
public Guid OrderId { get; set; }
[JsonProperty("CompletedOrderId")]
public string CompletedOrderId { get; set; }
[JsonProperty("CustomerId")]
public long CustomerId { get; set; }
[JsonProperty("CompletedTime")]
public DateTimeOffset CompletedTime { get; set; }
[JsonProperty("Email")]
public string Email { get; set; }
[JsonProperty("ShippingFirstName")]
public string ShippingFirstName { get; set; }
[JsonProperty("ShippingMiddleName")]
public string ShippingMiddleName { get; set; }
[JsonProperty("ShippingLastName")]
public string ShippingLastName { get; set; }
[JsonProperty("LineItems")]
public Dictionary<string, LineItem> LineItems { get; set; }
}
public partial class LineItem
{
[JsonProperty("qty")]
public long Qty { get; set; }
}
public partial class JsonEmailDeSerializer
{
public static JsonEmailDeSerializer FromJson(string json) => JsonConvert.DeserializeObject<JsonEmailDeSerializer>(json, FedExShipper.Converter.Settings);
}
public static class Serialize
{
public static string ToJson(this JsonEmailDeSerializer self) => JsonConvert.SerializeObject(self, FedExShipper.Converter.Settings);
}
internal static class Converter
{
public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings
{
MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
DateParseHandling = DateParseHandling.None,
Converters =
{
new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal }
},
};
}
Common approach to deserializing json with dynamic property names is to use Dictionary<string, ...>, in this case - Dictionary<string, List<MailCom>> can be used for Records property:
public partial class Result
{
[JsonProperty("records")]
public Dictionary<string, List<MailCom>> Records { get; set; }
[JsonProperty("errors")]
public List<Error> Errors { get; set; }
}
Json.NET can treat json object properties as keys for dictionary which makes it suitable to deserialize such dynamic data. The same is true for System.Text.Json.
That will never serialize to a class properly.
You'll have to use a lower-level API like Utf8JsonReader to read that level in the document, at least.
I have the class below:
public class Product
{
[JsonProperty("image")]
public string ImageURL { get; set; }
[JsonProperty("superDepartment")]
public string SuperDepartment { get; set; }
[JsonProperty("tpnb")]
public long TPNB { get; set; }
[JsonProperty("ContentsMeasureType")]
public string ContentsMeasureType { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("UnitOfSale")]
public int UnitOfSale { get; set; }
[JsonProperty("description")]
public IEnumerator<string> LstDescription { get; set; }
public string Description { get; set; }
[JsonProperty("AverageSellingUnitWeight")]
public decimal AverageSellingUnitWeight { get; set; }
[JsonProperty("UnitQuantity")]
public string UnitQuantity { get; set; }
[JsonProperty("id")]
public long ID { get; set; }
[JsonProperty("ContentsQuantity")]
public int ContentsQuantity { get; set; }
[JsonProperty("department")]
public string Department { get; set; }
[JsonProperty("price")]
public decimal Price { get; set; }
[JsonProperty("unitprice")]
public decimal UnitPrice { get; set; }
}
I have the method on the productController:
public async Task<ActionResult> MakeRequest(string q)// worked
{
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", "56ac439a92694577a2779f3d0ee0cd85");
var uri = string.Format("https://dev.tescolabs.com/grocery/products/?query={0}&offset={1}&limit={2}", q, 0, 10);
var response = await client.GetAsync(uri);
string body = await response.Content.ReadAsStringAsync();
Product myoutput = JsonConvert.DeserializeObject<Product>(body);
}
return View(body);
}
and I have the model below:
For some reason when I call the method MakeRequest it just shows the information as a string and an error saying Server Error as per picture below we can see the information from the api but it is showing as a string.
error message
The information from the api it should be showing on the table below:
table
How to show the data on the table? Or better how to convert the json array to a net object?
I know there is something missing in the part below of my method:
Product myoutput = JsonConvert.DeserializeObject<Product>(body);
You're passing json string to your View instead of your deserialized Product.
I assume your View expects model of type Product.
The return statement of MakeRequest action should be return View(myOutput);
I'll tell you in a simple way.
Your json model
-uk
--ghs
---products
----results
{
"uk" : {
"ghs" : {
"products": {
"input_query": "babana",
"output_query": "banana",
"filters": {},
"queryPhase": "post_primary",
"totals": {
"all": 109,
"new": 1,
"offer": 47
},
"config": "default",
"results": [
{
"image": "http://img.tesco.com/Groceries/pi/000/0261480000000/IDShot_90x90.jpg",
"superDepartment": "Fresh Food",
"tpnb": 50502269,
"ContentsMeasureType": "KG",
"name": "Tesco Bananas Loose",
"UnitOfSale": 3,
"description": [ "To help ensure the banana farms we source from are best in class we, and our", "suppliers, now work closely with the Rainforest Alliance, an international", "non profit organisation that works to conserve biodiversity and ensure", "sustainable livelihoods worldwide.", "The Rainforest Alliance Certified™ seal on our bananas a green frog nestled", "in a circle – helps us to tell the story of how they are sustainably sourced,", "and assure customers we are sourcing from responsibly managed farms." ],
"AverageSellingUnitWeight": 2.402,
"UnitQuantity": "KG",
"id": 275280804,
"ContentsQuantity": 1,
"department": "Fresh Fruit",
"price": 0.76,
"unitprice": 0.76
},
{
"image": "http://img.tesco.com/Groceries/pi/875/0000010001875/IDShot_90x90.jpg",
"superDepartment": "Fresh Food",
"tpnb": 65728590,
"ContentsMeasureType": "SNGL",
"name": "Tesco Ripe Bananas 5 Pack",
"UnitOfSale": 1,
"AverageSellingUnitWeight": 0.862,
"UnitQuantity": "EACH",
"id": 266419328,
"ContentsQuantity": 5,
"department": "Fresh Fruit",
"price": 0.9,
"unitprice": 0.18
},
{
"image": "http://img.tesco.com/Groceries/pi/416/0000003251416/IDShot_90x90.jpg",
"superDepartment": "Fresh Food",
"tpnb": 77427870,
"ContentsMeasureType": "SNGL",
"name": "Tesco Small Bananas 6 Pack",
"UnitOfSale": 1,
"description": [ "Small Bananas", "Tesco Small Bananas" ],
"AverageSellingUnitWeight": 0.965,
"UnitQuantity": "EACH",
"id": 285157326,
"ContentsQuantity": 6,
"department": "Fresh Fruit",
"price": 0.9,
"unitprice": 0.15
}
],
"suggestions": []
}
}
}
}
If you look at the above json result, you need a more comprehensive model.
For this you can enter the json result into a model here. look here
or keep the result object from its current state with dynamic.
string body = response.Content.ReadAsStringAsync().Result;
dynamic content = JObject.Parse(body);
var products = content.uk.ghs.products.results;
ok so im not entirely sure how to explain this but ill give it my best shot. i have deserialisation from json working on singular objects, but when i get a list of the objects in json form, it doesnt work, and there are a few extra details outside of the singular objects when in a list of the objects.
the line of code im pretty sure is the problem is
var model = JsonConvert.DeserializeObject<DeserializedObjects.BlockList>(JObject.Parse(json).ToString());
but i cannot figure out how to solve it.
anyway.
this is where the multiple data objects in json from come from:
public static async Task<DeserializedObjects.BlockList> GetUpToTenBlocks(int height)
{
var JData = (dynamic)new JObject();
JData.height = height;
String uri = String.Concat(partialApi, "/local/chain/blocks-after");
var response = await client.PostAsync(uri, new StringContent(JData.ToString(), Encoding.UTF8, "application/json"));
var content = response.Content;
{
var json = await content.ReadAsStringAsync();
var model = JsonConvert.DeserializeObject<DeserializedObjects.BlockList>(JObject.Parse(json).ToString());
Console.WriteLine(model.AtIndex[1].difficulty);
return model;
}
}
which is deserialized to:
public class PrevBlockHash
{
public string data { get; set; }
}
public class Block
{
public int timeStamp { get; set; }
public string signature { get; set; }
public PrevBlockHash prevBlockHash { get; set; }
public int type { get; set; }
public List<object> transactions { get; set; }
public int version { get; set; }
public string signer { get; set; }
public long height { get; set; }
}
public class Datum
{
public object difficulty { get; set; }
public List<object> txes { get; set; }
public Block block { get; set; }
public string hash { get; set; }
}
public class BlockList
{
public List<Datum> AtIndex { get; set; }
}
and this is the json payload:
{
"data": [
{
"difficulty": 11763927507942,
"txes": [],
"block": {
"timeStamp": 167479,
"signature": "bb062d9b5f132b39b9e56de2413bf04928af009587446621da7afd351d
15a2ce7b5504450acf41bc3b19ab71e9bf34722005239d93f05a2318130f85118df40c",
"prevBlockHash": {
"data": "d4875ad2fc74dacfa89a13f24159d14555d3766f4fe2d708a7596f84eba88
31b"
},
"type": 1,
"transactions": [],
"version": 1744830465,
"signer": "00a30788dc1f042da959309639a884d8f6a87086cda10300d2a7c3a0e0891
a4d",
"height": 1001
},
"hash": "f70898011d7343a0823de9c9cf263de29ddf2c16bb78cea626b9af90ea7ec260"
},
{
"difficulty": 11625594628802,
"txes": [],
"block": {
"timeStamp": 167561,
"signature": "116dedf43dd06b9ca634db0e20e06cc93337cdba155bced4d843ece4cc
9a57487d58e9a34d8a0e19bf71d3b7facb15179a87767f0063ebbce7c940cd545d5f01",
"prevBlockHash": {
"data": "f70898011d7343a0823de9c9cf263de29ddf2c16bb78cea626b9af90ea7ec
260"
},
"type": 1,
"transactions": [],
"version": 1744830465,
"signer": "6ecd181da287c9ccb0075336de36427f25cbc216dc6b1f0e87e35e41a39f6
3fe",
"height": 1002
},
"hash": "77b5644c35e0d0d51f8bb967d0d92e0ddb03c4ede6632cb3b7651b7394617562"
},
{
"difficulty": 11538802895169,
"txes": [],
"block": {
"timeStamp": 167624,
"signature": "982574132fdc99b6f484acdd3f1cb5229b2bf78ad7b4e9af3d7a1873da
b987401f8bf808ff749aca70c503f490db1411b6cd89dbb0c1daa24fd580f91d3d9601",
"prevBlockHash": {
"data": "77b5644c35e0d0d51f8bb967d0d92e0ddb03c4ede6632cb3b7651b7394617
562"
},
"type": 1,
"transactions": [],
"version": 1744830465,
"signer": "26a3ac4b24647c77dc87780a95e50cb8d7744966e4569e3ac24e52c532c0c
d0d",
"height": 1003
},
"hash": "1a6d52c6317150d1839790da2c1481d714038c869842f769affbec0fdeec9861"
}
]
}
Try this:
var model = JsonConvert.DeserializeObject<DeserializedObjects.BlockList>(json);
Console.WriteLine(model.data[1].difficulty);
along with, also:
public class BlockList
{
public List<Datum> data { get; set; }
}
Okay first of all, the answer is probably very simple... But after 45 minutes of trying and googling I just can't figure it out!
So I have some problems getting this Json to parse correctly. I created the classes with http://json2csharp.com/ only it doesn't tell me the code to parse it.
My current classes:
public class Representations
{
public string thumb { get; set; }
public string large { get; set; }
public string full { get; set; }
}
public class Search
{
public string id { get; set; }
public string file_name { get; set; }
public Representations representations { get; set; }
}
public class SearchQuery
{
public List<Search> search { get; set; }
public int total { get; set; }
}
JSON:
{
"search": [
{
"id": "0300",
"file_name": "0300.JPG",
"representations": {
"thumb": "thumb.jpg",
"large": "large.jpg",
"full": "0300.jpg"
},
},
{
"id": "0000",
"file_name": "0000.JPG",
"representations": {
"thumb": "thumb.jpg",
"large": "large.jpg",
"full": "0000.jpg"
},
},
{
"id": "0d00",
"file_name": "0d00.JPG",
"representations": {
"thumb": "thumb.jpg",
"large": "large.jpg",
"full": "0d00.jpg"
},
}
],
"total": 3
}
and code:
searchresults = JsonConvert.DeserializeObject<List<SearchQuery>>(JSONCode);
You should deserialize to a SearchQuery, not List<SearchQuery>:
SearchQuery result = JsonConvert.DeserializeObject<SearchQuery>(JSONCode);
and then use the search property to access the list of search results:
List<Search> searchResults = result.search;
This is an example of the Json files that I want to work with:
{
"type": "FeatureCollection",
"totalFeatures": 213,
"features": [
{
"type": "Feature",
"id": "world_contries.1",
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[
65.53080749511719,
37.248600006103516
],
[
65.6272964477539,
37.33319854736328
]
]
]
]
},
"geometry_name": "geom",
"properties": {
"name": "Afghanistan",
"iso_3_code": "AFG",
"iso_2_code": "AF",
"area": 65209,
"name_1": "Afghanistan",
"gmi_cntry": "AFG",
"region": "Asia",
"pop2005": 25067407,
"name_12": "Afghanistan"
}
},
{
"type": "Feature",
"id": "world_contries.2",
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[
19.282489776611328,
42.18553924560547
],
[
19.397319793701172,
42.31707000732422
]
]
]
]
},
"geometry_name": "geom",
"properties": {
"name": "Albania",
"iso_3_code": "ALB",
"iso_2_code": "AL",
"area": 2740,
"name_1": "Albania",
"gmi_cntry": "ALB",
"region": "Europe",
"pop2005": 3153731,
"name_12": "Albania"
}
},
]
}
In this type of files I want to have the geometry type and coordinates of all features.
I'm currently using this method to access the file:
public static List<string> getCoords(string path)
{
//List<string> layers = new List<string>();
string url = path;
WebRequest request = WebRequest.Create(url);
request.ContentType = "application/json";
request.Method = "GET";
try
{
WebResponse response = request.GetResponse();
StreamReader responseStream = new StreamReader(response.GetResponseStream());
string responseText = responseStream.ReadToEnd();
JObject o = JObject.Parse(responseText);
dynamic array = JsonConvert.DeserializeObject(responseText);
string type = array["features"].Children()["geometry"]["type"];
response.Close();
}
catch (WebException)
{
;
}
return null;
}
But it's not working. For instance:
array["features"].Children()["geometry"]["type"]
This is an Newtonsoft.JSon.Linq.JEnumerable
When I'm debugging in my Visual Studio, in the results view I can read "MultiPolygon", but I do I extract the value?
I used json2csharp (http://json2csharp.com) to generate some C# classes that match the JSON you provided..
public class Geometry
{
public string type { get; set; }
public List<List<List<List<double>>>> coordinates { get; set; }
}
public class Properties
{
public string name { get; set; }
public string iso_3_code { get; set; }
public string iso_2_code { get; set; }
public int area { get; set; }
public string name_1 { get; set; }
public string gmi_cntry { get; set; }
public string region { get; set; }
public int pop2005 { get; set; }
public string name_12 { get; set; }
}
public class Feature
{
public string type { get; set; }
public string id { get; set; }
public Geometry geometry { get; set; }
public string geometry_name { get; set; }
public Properties properties { get; set; }
}
public class RootObject
{
public string type { get; set; }
public int totalFeatures { get; set; }
public List<Feature> features { get; set; }
}
You could then modify your code so that it deserializes to the RootObject and it will be alot easier to work with instead of dynamic types...
var myObject = JsonConvert.DeserializeObject<RootObject>(responseText);
Then you could access it like this...
foreach (var feature in myObject.features)
{
var geometryType = feature.geometry.type;
....
}
You can simply loop through the JEnumerable to extract each geometry type :
.....
dynamic array = JsonConvert.DeserializeObject(json);
var types = array["features"].Children()["geometry"]["type"];
foreach (string type in types)
{
Console.WriteLine(type);
}