Im having a problem deserializing some json I get from a webserver and I think it is beacuse of the formating.
The json look like this :
{
"post_count": {
"total_posts": 1,
"sfw_total_posts": 1,
"use": 0
},
"posts_per_page": 1,
"posts": [
{
"guid": 10019127,
"wp_id": 656197,
"type": "media",
"title": "Test",
"path": "TestPath",
"publish_start": 1385559021,
"author": "Test",
"web_url": "http://www.test.com",
"nsfw": "No",
"modified": 1385532803,
"video": "No",
"likes": 484,
"dislikes": 51,
"main_category_id": 71,
"thumbnails": [
{
"w": 120,
"h": 120
},
{
"w": 240,
"h": 240
}
],
"comments": 26
}
],
"server": "100.200",
"time": 0.42163896560669
}
I have created a class with the value for there that I want to use and then using
LatestChive lastchives = JsonConvert.DeserializeObject<LatestChive>(jsonstring);
I try to deserialize it but all the values return null (I only want the stuff that is in "posts")
If I try with "post_count" or "posts_per_page" i can get the values just not from the the "posts"
I hope this makes sense and there is a easy fix thank you.
Define your classes as
public class PostCount
{
public int total_posts { get; set; }
public int sfw_total_posts { get; set; }
public int use { get; set; }
}
public class Thumbnail
{
public int w { get; set; }
public int h { get; set; }
}
public class Post
{
public int guid { get; set; }
public int wp_id { get; set; }
public string type { get; set; }
public string title { get; set; }
public string path { get; set; }
public int publish_start { get; set; }
public string author { get; set; }
public string web_url { get; set; }
public string nsfw { get; set; }
public int modified { get; set; }
public string video { get; set; }
public int likes { get; set; }
public int dislikes { get; set; }
public int main_category_id { get; set; }
public List<Thumbnail> thumbnails { get; set; }
public int comments { get; set; }
}
public class LatestChive
{
public PostCount post_count { get; set; }
public int posts_per_page { get; set; }
public List<Post> posts { get; set; }
public string server { get; set; }
public double time { get; set; }
}
For your future work see http://json2csharp.com/
Related
I have a json data as below -
{
"request": {
"type": "",
"query": "",
"language": "en",
"unit": "m"
},
"location": {
"name": "",
"country": "",
"region": "",
"lat": "",
"lon": "",
"timezone_id": "Asia/Kolkata",
"localtime": "2020-05-29 23:30",
"localtime_epoch": 1590795000,
"utc_offset": "5.50"
},
"current": {
"observation_time": "06:00 PM",
"temperature": 40,
"weather_code": 116,
"weather_icons": [
""
],
"weather_descriptions": [
"Partly cloudy"
],
"wind_speed": 9,
"wind_degree": 230,
"wind_dir": "SW",
"pressure": 1006,
"precip": 0,
"humidity": 26,
"cloudcover": 25,
"feelslike": 42,
"uv_index": 1,
"visibility": 6,
"is_day": "no"
},
"forecast": {
"2020-05-28": {
"date": "2020-05-28",
"date_epoch": 1590624000,
"astro": {
"sunrise": "05:41 AM",
"sunset": "06:46 PM",
"moonrise": "10:29 AM",
"moonset": "11:48 PM",
"moon_phase": "First Quarter",
"moon_illumination": 39
},
"mintemp": 32,
"maxtemp": 44,
"avgtemp": 38,
"totalsnow": 0,
"sunhour": 13.1,
"uv_index": 9
}
}
}
First Three nodes("request","location","current") are binding properly but for "forecast" since the first node is a date time. I have written in the following way-
var dataObjects = JsonConvert.DeserializeObject<Location_Weather.Weather>(customerJsonString);
var dataObjects23 = JsonConvert.DeserializeObject<Dictionary<string, dynamic>> (customerJsonString);
dynamic forecast_details = dataObjects23["forecast"];
This is my Model->
public class New_Location_Weather
{
[JsonProperty("request")]
public Request Request { get; set; }
[JsonProperty("location")]
public Location Location { get; set; }
[JsonProperty("current")]
public Current Current { get; set; }
[JsonProperty("forecast")]
public Forecast Forecast { get; set; }
}
public partial class Current
{
[JsonProperty("observation_time")]
public string ObservationTime { get; set; }
[JsonProperty("temperature")]
public long Temperature { get; set; }
[JsonProperty("weather_code")]
public long WeatherCode { get; set; }
[JsonProperty("weather_icons")]
public Uri[] WeatherIcons { get; set; }
[JsonProperty("weather_descriptions")]
public string[] WeatherDescriptions { get; set; }
[JsonProperty("wind_speed")]
public long WindSpeed { get; set; }
[JsonProperty("wind_degree")]
public long WindDegree { get; set; }
[JsonProperty("wind_dir")]
public string WindDir { get; set; }
[JsonProperty("pressure")]
public long Pressure { get; set; }
[JsonProperty("precip")]
public long Precip { get; set; }
[JsonProperty("humidity")]
public long Humidity { get; set; }
[JsonProperty("cloudcover")]
public long Cloudcover { get; set; }
[JsonProperty("feelslike")]
public long Feelslike { get; set; }
[JsonProperty("uv_index")]
public long UvIndex { get; set; }
[JsonProperty("visibility")]
public long Visibility { get; set; }
[JsonProperty("is_day")]
public string IsDay { get; set; }
}
public partial class Forecast
{
[JsonProperty("2020-05-28")]
public The20200528 The20200528 { get; set; }
}
public partial class The20200528
{
[JsonProperty("date")]
public DateTimeOffset Date { get; set; }
[JsonProperty("date_epoch")]
public long DateEpoch { get; set; }
[JsonProperty("astro")]
public Astro Astro { get; set; }
[JsonProperty("mintemp")]
public long Mintemp { get; set; }
[JsonProperty("maxtemp")]
public long Maxtemp { get; set; }
[JsonProperty("avgtemp")]
public long Avgtemp { get; set; }
[JsonProperty("totalsnow")]
public long Totalsnow { get; set; }
[JsonProperty("sunhour")]
public double Sunhour { get; set; }
[JsonProperty("uv_index")]
public long UvIndex { get; set; }
}
public partial class Astro
{
[JsonProperty("sunrise")]
public string Sunrise { get; set; }
[JsonProperty("sunset")]
public string Sunset { get; set; }
[JsonProperty("moonrise")]
public string Moonrise { get; set; }
[JsonProperty("moonset")]
public string Moonset { get; set; }
[JsonProperty("moon_phase")]
public string MoonPhase { get; set; }
[JsonProperty("moon_illumination")]
public long MoonIllumination { get; set; }
}
public partial class Location
{
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("country")]
public string Country { get; set; }
[JsonProperty("region")]
public string Region { get; set; }
[JsonProperty("lat")]
public string Lat { get; set; }
[JsonProperty("lon")]
public string Lon { get; set; }
[JsonProperty("timezone_id")]
public string TimezoneId { get; set; }
[JsonProperty("localtime")]
public string Localtime { get; set; }
[JsonProperty("localtime_epoch")]
public long LocaltimeEpoch { get; set; }
[JsonProperty("utc_offset")]
public string UtcOffset { get; set; }
}
public partial class Request
{
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("query")]
public string Query { get; set; }
[JsonProperty("language")]
public string Language { get; set; }
[JsonProperty("unit")]
public string Unit { get; set; }
}
Now issue is I am not able to get the values. I need some guidance on how to get this values from the dynamic object which is forecast_details into my C# code.
Below is the screenshot of the values which I need to access them in my c# code
While debugging the dynamic object I found the values in my result view. But I am not sure how to access those values in my c# code.
Please do let me know on how to get these values from my C# dynamic object(forecast_details).
Look at this question, there is two answers that can help you.
How to add properties at runtime to JSON (C#)
You can parse your forecast json to JObject, and get all values from it with foreach.
This is what I figured it out. Hope it helps for others to.
JObject obj = JObject.Parse(customerJsonString);
var forecast_details = obj.SelectToken("forecast").Children().OfType<JProperty>()
.ToDictionary(p => p.Name, p => new
{
MaxTemp = (int)p.First()["maxtemp"],
MinTemp = (int)p.First()["mintemp"]
});
if(forecast_details.Count>0)
{
int max_temp = forecast_details.Values.Select(x => x.MaxTemp).FirstOrDefault();
int min_temp = forecast_details.Values.Select(x => x.MinTemp).FirstOrDefault();
}
I have a JSON API result that I processed thru an online JSON-to-C# structure program to create the class structure. I've used this many times for other projects. The JSON returned everything along with a public class RootObject that references both the status and payload segments of the returned values.
I am using ASP.NET C# library to deserialize the result JSON using JavaScriptSerializer:
var vlist = new JavaScriptSerializer().Deserialize<TestStruct>(result);
My data structure looks like this (it's pretty standard):
public class TestStruct
{
public class Status
{
public int statusCode { get; set; }
public int errorType { get; set; }
public int errorCode { get; set; }
public string errorMessage { get; set; }
}
public class Payload
{
public VehicleStatusRpt vehicleStatusRpt { get; set; }
}
public class VehicleStatusRpt
{
public string statusType { get; set; }
//public ReportDate reportDate { get; set; }
//public VehicleStatus vehicleStatus { get; set; }
}
public class RootObject
{
public Status status { get; set; }
public Payload payload { get; set; }
}
}
The full JSON Result I'm trying to parse using the class structure is:
{
"status": {
"statusCode": 0,
"errorType": 0,
"errorCode": 0,
"errorMessage": "Success with response body"
},
"payload": {
"vehicleSummary": [
{
"vin": "KNDJX3AE8E7000080",
"vehicleIdentifier": "000080",
"modelName": "SOUL EV",
"modelYear": "2015",
"nickName": "My SOUL",
"generation": 1,
"extColorCode": "1D",
"trim": "EV",
"imagePath": {
"imageName": "2015-soul_ev-ev-1d.png",
"imagePath": "/content/dam/kia/us/owners/image/vehicle/2015/soul_ev/ev/",
"imageType": "1",
"imageSize": {
"length": "100",
"width": "100",
"uom": 0
}
},
"enrollmentStatus": 1,
"fatcAvailable": 1,
"telematicsUnit": 1,
"fuelType": 4,
"colorName": "CLEAR WHITE",
"activationType": 1,
"mileage": "24410",
"dealerCode": "MOBISDLR1",
"mobileStore": [
{
"osType": 0,
"downloadURL": "https://itunes.apple.com/us/app/kia-access-with-uvo-link/id1280548773?mt=8",
"image": {
"imageName": "iosImage.png",
"imagePath": "/content/dam/kia/us/owners/image/common/app/",
"imageType": "2",
"imageSize": {
"length": "100",
"width": "100",
"uom": 0
}
}
},
{
"osType": 1,
"downloadURL": "https://play.google.com/store/apps/details?id=com.myuvo.link",
"image": {
"imageName": "androidImage.png",
"imagePath": "/content/dam/kia/us/owners/image/common/app/",
"imageType": "2",
"imageSize": {
"length": "100",
"width": "100",
"uom": 0
}
}
}
],
"supportedApp": {
"appType": "5",
"appImage": {
"imageName": "app-access.png",
"imagePath": "/content/dam/kia/us/owners/image/common/app/access/",
"imageType": "2",
"imageSize": {
"length": "100",
"width": "100",
"uom": 0
}
}
},
"supportAdditionalDriver": 0,
"customerType": 0,
"vehicleKey": "937db044-8328-4188-a3d2-68ac3b183752"
}
]
}
}
I run this thru json2csharp.com to get the structure (the sample above is an abbreviated 'test' only
The deserializer returns an error: Invalid JSON Primitive (starting with Payload)
I see examples of using RootObject but with the Newtonsoft JSON libary. I would like to use the Microsoft library. Do I really need to switch to Newtonsoft JSON? If I can use JavaScriptSerializer library, how?
The classes that correspond to the JSON you posted are:
public class RootObject
{
public Status status { get; set; }
public Payload payload { get; set; }
}
public class Status
{
public int statusCode { get; set; }
public int errorType { get; set; }
public int errorCode { get; set; }
public string errorMessage { get; set; }
}
public class Payload
{
public List<VehicleSummary> vehicleSummary { get; set; }
}
public class VehicleSummary
{
public string vin { get; set; }
public string vehicleIdentifier { get; set; }
public string modelName { get; set; }
public string modelYear { get; set; }
public string nickName { get; set; }
public int generation { get; set; }
public string extColorCode { get; set; }
public string trim { get; set; }
public Image imagePath { get; set; }
public int enrollmentStatus { get; set; }
public int fatcAvailable { get; set; }
public int telematicsUnit { get; set; }
public int fuelType { get; set; }
public string colorName { get; set; }
public int activationType { get; set; }
public string mileage { get; set; }
public string dealerCode { get; set; }
public List<MobileStore> mobileStore { get; set; }
public SupportedApp supportedApp { get; set; }
public int supportAdditionalDriver { get; set; }
public int customerType { get; set; }
public string vehicleKey { get; set; }
}
public class Image
{
public string imageName { get; set; }
public string imagePath { get; set; }
public string imageType { get; set; }
public ImageSize imageSize { get; set; }
}
public class ImageSize
{
public string length { get; set; }
public string width { get; set; }
public int uom { get; set; }
}
public class MobileStore
{
public int osType { get; set; }
public string downloadURL { get; set; }
public Image image { get; set; }
}
public class SupportedApp
{
public string appType { get; set; }
public Image appImage { get; set; }
}
I was able to deserialize the JSON just fine using JavaScriptSerializer like this:
var root = new JavaScriptSerializer().Deserialize<RootObject>(result);
where result is the JSON string you posted in your question.
Note, however, that if you have placed your classes inside another class called TestStruct then you would need to take that into account and deserialize to TestStruct.RootObject instead, e.g.:
var root = new JavaScriptSerializer().Deserialize<TestStruct.RootObject>(result);
I was also able to deserialize the JSON using Json.Net in the same way with the JsonConvert class:
var root = JsonConvert.DeserializeObject<RootObject>(result);
Once you have the deserialized object, you can extract some interesting information from it like this:
foreach (var vs in root.payload.vehicleSummary)
{
Console.WriteLine(string.Format("{0} - {1} {2} {3}, {4} mi",
vs.vin, vs.colorName, vs.modelYear, vs.modelName, vs.mileage));
}
Here is a working demo using Json.Net: https://dotnetfiddle.net/Zh35be
I have a JSON object with a dynamic key for the properties I wish to map to a class. I'm uncertain how to build my class to deserialize with JSON.NET. I need the values from the 'results' and 'more' keys at the upper level and also the the values from the 'timesheets' key.
Here is my JSON data.
{
"results": {
"timesheets": {
"7994790": {
"id": 7994790,
"user_id": 165502,
"jobcode_id": 11267673,
"start": "2019-12-20T05:48:00-05:00",
"end": "2019-12-20T13:44:00-05:00",
"duration": 28560,
"date": "2019-12-20",
"tz": -5,
"tz_str": "tsET",
"type": "regular",
"location": "Android App",
"on_the_clock": false,
"locked": 0,
"notes": "",
"customfields": {
"20251": "",
"19647": "Laborer",
"20327": "",
"19648": ""
},
"last_modified": "2019-12-20T20:28:48+00:00",
"attached_files": [],
"created_by_user_id": 165502
},
"8087496": {
"id": 8087496,
"user_id": 165502,
"jobcode_id": 2415904,
"start": "2019-12-20T13:44:00-05:00",
"end": "2019-12-20T15:11:00-05:00",
"duration": 5220,
"date": "2019-12-20",
"tz": -5,
"tz_str": "tsET",
"type": "regular",
"location": "Android App",
"on_the_clock": false,
"locked": 0,
"notes": "",
"customfields": {
"20251": "",
"19647": "Laborer",
"20327": "",
"19648": ""
},
"last_modified": "2019-12-20T20:28:49+00:00",
"attached_files": [],
"created_by_user_id": 165502
}
}
},
"more": false
}
And my classes as I currently have them which returns this error.
System.ArgumentNullException: 'Value cannot be null.
Parameter name: values'
public class RootObject
{
public Results results { get; set; }
public bool more { get; set; }
}
public class Results
{
public Timesheets timesheets { get; set; }
}
public class Timesheets
{
public Dictionary<int, TimesheetDetails> timesheetsdetails { get; set; }
}
public class TimesheetDetails
{
public int id { get; set; }
public int user_id { get; set; }
public int jobcode_id { get; set; }
public DateTime start { get; set; }
public DateTime end { get; set; }
public int duration { get; set; }
public string date { get; set; }
public int tz { get; set; }
public string tz_str { get; set; }
public string type { get; set; }
public string location { get; set; }
public bool on_the_clock { get; set; }
public int locked { get; set; }
public string notes { get; set; }
public DateTime last_modified { get; set; }
public List<object> attached_files { get; set; }
public int created_by_user_id { get; set; }
}
var stuff = JsonConvert.DeserializeObject<RootObject>(result.Content);
Console.WriteLine(string.Join(",", stuff.results.timesheets.timesheetsdetails));
First of all your json is not valid. After the end of the first timesheet data, there should be a , You can use any json validator online simply to validate it.
And in your model the Results is not valid according to the json. The below one works for me.
public class Response
{
[JsonProperty("results")] public TimeSheetResponse TimeSheetResponse { get; set; }
[JsonProperty("more")] public bool More { get; set; }
}
public class TimeSheetResponse
{
[JsonProperty("timesheets")] public Dictionary<string, Timesheet> Timesheets { get; set; }
}
public class Timesheet
{
[JsonProperty("id")]
public long Id { get; set; }
[JsonProperty("user_id")]
public long UserId { get; set; }
[JsonProperty("jobcode_id")]
public long JobcodeId { get; set; }
[JsonProperty("start")] public DateTimeOffset Start { get; set; }
[JsonProperty("end")] public DateTimeOffset End { get; set; }
[JsonProperty("duration")] public long Duration { get; set; }
[JsonProperty("date")] public DateTimeOffset Date { get; set; }
[JsonProperty("tz")] public long Tz { get; set; }
[JsonProperty("tz_str")] public string TzStr { get; set; }
[JsonProperty("type")] public string Type { get; set; }
[JsonProperty("location")] public string Location { get; set; }
[JsonProperty("on_the_clock")] public bool OnTheClock { get; set; }
[JsonProperty("locked")] public long Locked { get; set; }
[JsonProperty("notes")] public string Notes { get; set; }
[JsonProperty("customfields")] public Dictionary<string, string> Customfields { get; set; }
[JsonProperty("last_modified")] public DateTimeOffset LastModified { get; set; }
[JsonProperty("attached_files")] public List<object> AttachedFiles { get; set; }
[JsonProperty("created_by_user_id")]
public long CreatedByUserId { get; set; }
}
To deserialize to Object..
var timeSheetResult = JsonConvert.DeserializeObject<Response>(data);
How can we extract or retrieve child nodes values from JSON structure in C#.
my app is using OpenWeatherMap, I need to retrieve name from city, temp from list and description from weather nodes, my JSON and Class structure are below
{
"cod": "200",
"message": 0.0284,
"city": {
"id": 2643743,
"name": "London",
"coord": {
"lon": -0.12574,
"lat": 51.50853
},
"country": "GB",
"population": 0,
"sys": {
"population": 0
}
},
"cnt": 1,
"list": [
{
"dt": 1429268400,
"temp": {
"day": 12.21,
"min": 4.86,
"max": 13.18,
"night": 4.86,
"eve": 11.76,
"morn": 12.21
},
"pressure": 1028.8,
"humidity": 66,
"weather": [
{
"id": 803,
"main": "Clouds",
"description": "broken clouds",
"icon": "04d"
}
],
"speed": 5.9,
"deg": 67,
"clouds": 80
}
]
}
C# Class
public class WeatherForeCast
{
public string City { get; set; }
public decimal Day { get; set; }
public decimal Min { get; set; }
public decimal Max { get; set; }
public decimal Night { get; set; }
public string Description { get; set; }
}
Till date I'm familiar with using JSON.net for serialize and deserialize C# objects to JSON which has exact same structure.
If you just want to populate an instance of WeatherForecast, you could use a few SelectToken calls on a plain JObject:
var parsed = JObject.Parse(json);
var forecast = new WeatherForeCast();
forecast.City = parsed.SelectToken("city.name").Value<string>();
forecast.Day = parsed.SelectToken("list[0].temp.day").Value<decimal>();
forecast.Description = parsed.SelectToken("list[0].weather[0].description").Value<string>();
forecast.Min = parsed.SelectToken("list[0].temp.min").Value<decimal>();
forecast.Max = parsed.SelectToken("list[0].temp.max").Value<decimal>();
forecast.Night = parsed.SelectToken("list[0].temp.night").Value<decimal>();
Note that this is pretty brittle though, it's making assumptions about the contents of the JSON. If the JSON changes, the path to various properties in SelectToken will be incorrect and this code will throw an exception.
Use json2csharp.com to generate your classes.
public class Coord
{
public double lon { get; set; }
public double lat { get; set; }
}
public class Sys
{
public int population { get; set; }
}
public class City
{
public int id { get; set; }
public string name { get; set; }
public Coord coord { get; set; }
public string country { get; set; }
public int population { get; set; }
public Sys sys { get; set; }
}
public class Temp
{
public double day { get; set; }
public double min { get; set; }
public double max { get; set; }
public double night { get; set; }
public double eve { get; set; }
public double morn { get; set; }
}
public class Weather
{
public int id { get; set; }
public string main { get; set; }
public string description { get; set; }
public string icon { get; set; }
}
public class List
{
public int dt { get; set; }
public Temp temp { get; set; }
public double pressure { get; set; }
public int humidity { get; set; }
public List<Weather> weather { get; set; }
public double speed { get; set; }
public int deg { get; set; }
public int clouds { get; set; }
}
public class RootObject
{
public string cod { get; set; }
public double message { get; set; }
public City city { get; set; }
public int cnt { get; set; }
public List<List> list { get; set; }
}
Then use JSON.NET to deserialize into the class structure and extract the properties you want.
var jsonObject = JsonConvert.DeserializeObject<RootObject>(jsonString);
You now have an instance of RootObject and you can traverse it as needed to extract the specific value(s) you need.
How can I De-serialize following json?
{
"data": {
"11396": {
"description": "Timer project",
"status": "ACTIVE",
"customer": {
"locations": {},
"id": 96626
},
"tasks": [
{
"description": "Timer Task",
"unit": "h",
"vatPct": 0.2,
"unitPrice": 12,
"billable": true,
"id": 19660
}
],
"price": 0,
"pricing": "UNIT",
"allowProducts": true,
"hasUninvoicedItems": false,
"id": 11396
},
"11397": {
"description": "Timer Project 2",
"status": "ACTIVE",
"customer": {
"locations": {},
"id": 96626
},
"tasks": [
{
"description": "Timer Task2",
"unit": "h",
"vatPct": 0.05,
"unitPrice": 20,
"billable": true,
"id": 19655
}
],
"price": 0,
"pricing": "UNIT",
"allowProducts": true,
"hasUninvoicedItems": false,
"id": 11397
}
},
"ok": true
}
The problem is that values 11396, 11397 as class name (if convert to c#) which are actually ids of that particular record. so when converting this json to c# using http://json2csharp.com. it shows as this
public class Locations
{
}
public class Customer
{
public Locations locations { get; set; }
public int id { get; set; }
}
public class Task
{
public string description { get; set; }
public string unit { get; set; }
public double vatPct { get; set; }
public double unitPrice { get; set; }
public bool billable { get; set; }
public int id { get; set; }
}
public class __invalid_type__11397
{
public string description { get; set; }
public string status { get; set; }
public Customer customer { get; set; }
public List<Task> tasks { get; set; }
public double price { get; set; }
public string pricing { get; set; }
public bool allowProducts { get; set; }
public bool hasUninvoicedItems { get; set; }
public int id { get; set; }
}
public class Locations2
{
}
public class Customer2
{
public Locations2 locations { get; set; }
public int id { get; set; }
}
public class Task2
{
public string description { get; set; }
public string unit { get; set; }
public double vatPct { get; set; }
public double unitPrice { get; set; }
public bool billable { get; set; }
public int id { get; set; }
}
public class __invalid_type__11396
{
public string description { get; set; }
public string status { get; set; }
public Customer2 customer { get; set; }
public List<Task2> tasks { get; set; }
public double price { get; set; }
public string pricing { get; set; }
public bool allowProducts { get; set; }
public bool hasUninvoicedItems { get; set; }
public int id { get; set; }
}
public class Data
{
public __invalid_type__11397 __invalid_name__11397 { get; set; }
public __invalid_type__11396 __invalid_name__11396 { get; set; }
}
public class RootObject
{
public Data data { get; set; }
public bool ok { get; set; }
}
any help is much appreciated.
I resolved this issue by parsing the json string to JTOKEN and the querying the required data.
This was possible because my datas inside json was static
JToken token = JObject.Parse(response);
var justDaily = token["data"];
ProjectList = new List<Project>();
foreach (JToken child in justDaily.Children())
{
foreach (JToken grandChild in child)
{
Project temp = JsonConvert.DeserializeObject<Project>(grandChild.ToString().Replace("\r\n", ""));
ProjectList.Add(temp);
}
}
Hope this will help someone else also