How can i extract this data in c#, in order to get all elements that i need:
{ "id": "PAY-6A414645MC669653MKPB2WCI", "create_time": "2014-07-14T10:03:53Z", "update_time": "2014-07-14T10:05:09Z", "intent": "sale", "payer": { "payment_method": "paypal", "payer_info": { "email": "severiano.testes#gmail.com", "first_name": "tester", "last_name": "tester", "payer_id": "MSQ6UB55W52N6", "shipping_address": { "line1": "1 Main Terrace", "line2": "", "city": "Wolverhampton", "country_code": "GB", "postal_code": "W12 4LQ", "state": "West Midlands" } } }, "transactions": [ { "amount": { "currency": "EUR", "total": "54.00", "details": { "subtotal": "54.00" } }, "description": "Transaction Description", "item_list": { "items": [ { "quantity": "1", "name": "Project Submission (featured)", "price": "54.00", "currency": "EUR", "sku": "64866" } ], "shipping_address": { "recipient_name": "tester tester", "line1": "1 Main Terrace", "line2": "", "city": "Wolverhampton", "country_code": "GB", "postal_code": "W12 4LQ", "state": "West Midlands" } }, "related_resources": [ { "sale": { "id": "4VV61663EL511901P", "create_time": "2014-07-14T10:03:53Z", "update_time": "2014-07-14T10:05:09Z", "amount": { "currency": "EUR", "total": "54.00" }, "state": "pending", "parent_payment": "PAY-6A414645MC669653MKPB2WCI", "links": [ { "href": "https://api.sandbox.paypal.com/v1/payments/sale/4VV61663EL511901P", "rel": "self", "method": "GET" }, { "href": "https://api.sandbox.paypal.com/v1/payments/sale/4VV61663EL511901P/refund", "rel": "refund", "method": "POST" }, { "href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-6A414645MC669653MKPB2WCI", "rel": "parent_payment", "method": "GET" } ] } } ] } ], "state": "pending", "links": [ { "href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-6A414645MC669653MKPB2WCI", "rel": "self", "method": "GET" } ] }
I've tried to send to jquery function but not successfull.
I've tried this aswell:
JObject.Parse(HttpContext.Current.Items["ResponseJson"]).GetValue("id");
this works but only to one value, not all that i want
you have to declare class like
public class Rootobject
{
public string id { get; set; }
public DateTime create_time { get; set; }
public DateTime update_time { get; set; }
public string intent { get; set; }
public Payer payer { get; set; }
public Transaction[] transactions { get; set; }
public string state { get; set; }
public Link1[] links { get; set; }
}
public class Payer
{
public string payment_method { get; set; }
public Payer_Info payer_info { get; set; }
}
public class Payer_Info
{
public string email { get; set; }
public string first_name { get; set; }
public string last_name { get; set; }
public string payer_id { get; set; }
public Shipping_Address shipping_address { get; set; }
}
public class Shipping_Address
{
public string line1 { get; set; }
public string line2 { get; set; }
public string city { get; set; }
public string country_code { get; set; }
public string postal_code { get; set; }
public string state { get; set; }
}
public class Transaction
{
public Amount amount { get; set; }
public string description { get; set; }
public Item_List item_list { get; set; }
public Related_Resources[] related_resources { get; set; }
}
public class Amount
{
public string currency { get; set; }
public string total { get; set; }
public Details details { get; set; }
}
public class Details
{
public string subtotal { get; set; }
}
public class Item_List
{
public Item[] items { get; set; }
public Shipping_Address1 shipping_address { get; set; }
}
public class Shipping_Address1
{
public string recipient_name { get; set; }
public string line1 { get; set; }
public string line2 { get; set; }
public string city { get; set; }
public string country_code { get; set; }
public string postal_code { get; set; }
public string state { get; set; }
}
public class Item
{
public string quantity { get; set; }
public string name { get; set; }
public string price { get; set; }
public string currency { get; set; }
public string sku { get; set; }
}
public class Related_Resources
{
public Sale sale { get; set; }
}
public class Sale
{
public string id { get; set; }
public DateTime create_time { get; set; }
public DateTime update_time { get; set; }
public Amount1 amount { get; set; }
public string state { get; set; }
public string parent_payment { get; set; }
public Link[] links { get; set; }
}
public class Amount1
{
public string currency { get; set; }
public string total { get; set; }
}
public class Link
{
public string href { get; set; }
public string rel { get; set; }
public string method { get; set; }
}
public class Link1
{
public string href { get; set; }
public string rel { get; set; }
public string method { get; set; }
}
Then you have to use using Newtonsoft.Json; for DeserializeObject like
var Data = JsonConvert.DeserializeObject<Rootobject>("your Json string");
you can access the property using Data
O/P looks like
You need to just make a mapping object and then deserialize the json
public class PaymentResponse
{
public string id { get; set; }
public DateTime create_time { get; set; }
public DateTime update_time { get; set; }
public string intent {get; set; }
public Payer payer{get; set; }
}
public class Payer
{
public string payment_method {get;set;}
public PayerInfo payer_info {get;set;}
}
public class PayerInfo
{
public string email { get; set; }
public string first_name { get; set; }
}
Don't have time to add all of the values but if you use a json parser so you can see the response easier. I prefer this one.
http://json.parser.online.fr/
Then simply deserialize the json response with the below
var paymentResponse = new JavaScriptSerializer().Deserialize<PaymentResponse>(jsonString);
Related
I'm trying to create a basic Xamarin Forms app that can list available gateways on my PFsense firewall, Show the available gateway and change this to another gateway to route through if required. The problem I have is I cannot deserialize the JSON in C# because each object has a different object name:
{
"status": "ok",
"code": 200,
"return": 0,
"message": "Success",
"data": {
"GW_WAN_1": {
"interface": "hn0",
"gateway": "192.168.0.1",
"name": "GW_WAN_1",
"weight": "1",
"ipprotocol": "inet",
"interval": "500",
"time_period": "60000",
"alert_interval": "1000",
"descr": "Interface wan Gateway",
"data_payload": "1",
"latencylow": "200",
"latencyhigh": "500",
"losslow": "10",
"losshigh": "20",
"loss_interval": "2000",
"monitor": "192.168.0.1",
"friendlyiface": "wan",
"friendlyifdescr": "RED",
"isdefaultgw": true,
"attribute": 0,
"tiername": "Default (IPv4)"
},
"INT1_DHCP6": {
"dynamic": true,
"ipprotocol": "inet6",
"gateway": "fe80::1af1:45ff:fe90:4b13",
"interface": "hn0",
"friendlyiface": "wan",
"friendlyifdescr": "RED",
"name": "INT1_DHCP6",
"attribute": "system",
"isdefaultgw": true,
"monitor": "fe80::1af1:45ff:fe90:4b13",
"descr": "Interface RED_DHCP6 Gateway",
"tiername": ""
},
"VPN_EUR_1": {
"interface": "ovpns1",
"gateway": "192.168.1.2",
"name": "VPN_EUR_1",
"weight": "1",
"ipprotocol": "inet",
"interval": "500",
"time_period": "60000",
"alert_interval": "1000",
"descr": "Interface VPN_EUR_1 Gateway",
"data_payload": "1",
"latencylow": "200",
"latencyhigh": "500",
"losslow": "10",
"losshigh": "20",
"loss_interval": "2000",
"dynamic": true,
"monitor": "192.168.1.2",
"friendlyiface": "opt4",
"friendlyifdescr": "VPN_EUR_1",
"attribute": 1,
"tiername": ""
},
"Null4": {
"name": "Null4",
"interface": "lo0",
"ipprotocol": "inet",
"gateway": "127.0.0.1",
"attribute": "system",
"tiername": ""
},
"Null6": {
"name": "Null6",
"interface": "lo0",
"ipprotocol": "inet6",
"gateway": "::1",
"attribute": "system",
"tiername": ""
},
"VPN_EUR_1V6": {
"dynamic": false,
"ipprotocol": "inet6",
"gateway": null,
"interface": "ovpns1",
"friendlyiface": "opt4",
"friendlyifdescr": "VPN_EUR_1",
"name": "VPN_EUR_1V6",
"attribute": "system",
"descr": "Interface VPN_EUR_1V6 Gateway",
"tiername": ""
}
}
}
Here's how I've gone about trying to deserialize:
string authHeader = Constants.AUTH_HEADER;
client.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", authHeader);
var response = await client.GetAsync(Constants.GATEWAY);
var json = await response.Content.ReadAsStringAsync();
var gateways = JsonConvert.DeserializeObject<Data>(json);
The C# Object (Generated using json to C# converter):
public class GW_WAN_1
{
public string #interface { get; set; }
public string gateway { get; set; }
public string name { get; set; }
public string weight { get; set; }
public string ipprotocol { get; set; }
public string interval { get; set; }
public string time_period { get; set; }
public string alert_interval { get; set; }
public string descr { get; set; }
public string data_payload { get; set; }
public string latencylow { get; set; }
public string latencyhigh { get; set; }
public string losslow { get; set; }
public string losshigh { get; set; }
public string loss_interval { get; set; }
public string monitor { get; set; }
public string friendlyiface { get; set; }
public string friendlyifdescr { get; set; }
public bool isdefaultgw { get; set; }
public int attribute { get; set; }
public string tiername { get; set; }
}
public class INT1_DHCP6
{
public bool dynamic { get; set; }
public string ipprotocol { get; set; }
public string gateway { get; set; }
public string #interface { get; set; }
public string friendlyiface { get; set; }
public string friendlyifdescr { get; set; }
public string name { get; set; }
public string attribute { get; set; }
public bool isdefaultgw { get; set; }
public string monitor { get; set; }
public string descr { get; set; }
public string tiername { get; set; }
}
public class VPN_EUR_1
{
public string #interface { get; set; }
public string gateway { get; set; }
public string name { get; set; }
public string weight { get; set; }
public string ipprotocol { get; set; }
public string interval { get; set; }
public string time_period { get; set; }
public string alert_interval { get; set; }
public string descr { get; set; }
public string data_payload { get; set; }
public string latencylow { get; set; }
public string latencyhigh { get; set; }
public string losslow { get; set; }
public string losshigh { get; set; }
public string loss_interval { get; set; }
public bool dynamic { get; set; }
public string monitor { get; set; }
public string friendlyiface { get; set; }
public string friendlyifdescr { get; set; }
public int attribute { get; set; }
public string tiername { get; set; }
}
public class Null4
{
public string name { get; set; }
public string #interface { get; set; }
public string ipprotocol { get; set; }
public string gateway { get; set; }
public string attribute { get; set; }
public string tiername { get; set; }
}
public class Null6
{
public string name { get; set; }
public string #interface { get; set; }
public string ipprotocol { get; set; }
public string gateway { get; set; }
public string attribute { get; set; }
public string tiername { get; set; }
}
public class VPN_EUR_1V6
{
public bool dynamic { get; set; }
public string ipprotocol { get; set; }
public object gateway { get; set; }
public string #interface { get; set; }
public string friendlyiface { get; set; }
public string friendlyifdescr { get; set; }
public string name { get; set; }
public string attribute { get; set; }
public string descr { get; set; }
public string tiername { get; set; }
}
public class Data
{
public GW_WAN_1 GW_WAN { get; set; }
public INT1_DHCP6 INT1_DHCP6 { get; set; }
public VPN_EUR_1 VPN_EUR_1 { get; set; }
public Null4 Null4 { get; set; }
public Null6 Null6 { get; set; }
public VPN_EUR_1V6 VPN_NL_VPNV6 { get; set; }
}
public class Root
{
public string status { get; set; }
public int code { get; set; }
public int #return { get; set; }
public string message { get; set; }
public Data data { get; set; }
}
The problem is in the gateways variable, all of the properties are null. I think because of how the JSON is structured in the response, it might not be possible in C#, but perhaps there's another way of going about it?
The API for the firewall is here:
https://github.com/jaredhendrickson13/pfsense-api
Thanks
I have this Json:
{
"trades": [
{
"id": "4004",
"instrument": "EUR_USD",
"price": "1.08938",
"openTime": "2020-02-26T12:15:32.309973340Z",
"initialUnits": "1",
"initialMarginRequired": "0.0363",
"state": "OPEN",
"currentUnits": "1",
"realizedPL": "0.0000",
"financing": "0.0000",
"dividendAdjustment": "0.0000",
"unrealizedPL": "-0.0026",
"marginUsed": "0.0362",
"takeProfitOrder": {
"id": "4005",
"createTime": "2020-02-26T12:15:32.309973340Z",
"type": "TAKE_PROFIT",
"tradeID": "4004",
"price": "1.09099",
"timeInForce": "GTC",
"triggerCondition": "DEFAULT",
"state": "PENDING"
}
}
],
"lastTransactionID": "4010"
}
And Classes:
public class TakeProfitOrder
{
public string id { get; set; }
public string createTime { get; set; }
public string type { get; set; }
public string tradeID { get; set; }
public string price { get; set; }
public string timeInForce { get; set; }
public string triggerCondition { get; set; }
public string state { get; set; }
}
public class Trade
{
public string id { get; set; }
public string instrument { get; set; }
public string price { get; set; }
public string openTime { get; set; }
public string initialUnits { get; set; }
public string initialMarginRequired { get; set; }
public string state { get; set; }
public string currentUnits { get; set; }
public string realizedPL { get; set; }
public string financing { get; set; }
public string dividendAdjustment { get; set; }
public string unrealizedPL { get; set; }
public string marginUsed { get; set; }
public TakeProfitOrder takeProfitOrder { get; set; }
}
public class RootObject
{
public List<Trade> trades { get; set; }
public string lastTransactionID { get; set; }
}
I deserialize with :
var result = JsonConvert.DeserializeObject<RootObject>(Json);
var price = result.trades.Select(p => p.price).ToList();
price.ForEach(Console.WriteLine);
It works. I can access "price" in "trades", but I do not know how to access the "price" in "takeProfitOrder". I need the value of "price" from "takeProfitOrder" in to a list. I am sure it is something very simple but I cannot figure out how to do it, even after looking at some similar examples.
Can somebody please help me?
It's simple
result.trades.Select(p => p.takeProfitOrder.price)
You should understand better from this example
foreach (Trade trade in result.trades)
{
TakeProfitOrder takeProfitOrder = trade.takeProfitOrder;
Console.WriteLine(takeProfitOrder.price);
}
"Data": [{
"timeLive": "74",
"halfTimeScore": "0 - 0",
"fullTimeScore": null,
"firstTeamToScore": null,
"homeTeamInfo": {
"homeTeam": "Atlético Mineiro",
"homeGoals": "0",
"homeGoalsHalfTime": "0",
"homeCorners": "9",
"homeYellowCards": "1",
"homeRedCards": "0",
"homeShotsGol": "3",
"homeShotsFora": "9",
"homeAttacks": "131",
"homeDangerousAttack": "49",
"homePossession": "74",
"homeFouls": 13,
"avgGoalsHome": 2.1,
"teamID": "43669",
"homeTeamForm": {
"position": "6",
"points": "33",
"form": [
"W",
"D",
"L",
"W",
"W"
]
}
},
"awayTeamInfo": {
"awayTeam": "Vasco da Gama",
"awayGoals": "0",
"awayGoalsHalfTime": "0",
"awayCorners": "1",
"awayYellowCards": "3",
"awayRedCards": "0",
"awayShotsGol": "3",
"awayShotsFora": "4",
"awayAttacks": "58",
"awayDangerousAttack": "21",
"awayPossession": "26",
"awayFouls": 14,
"avgGoalsAway": 0.9,
"teamID": "43663",
"awayTeamForm": {
"position": "15",
"points": "20",
"form": [
"W",
"L",
"L",
"L",
"D"
]
}
},
"head2head": {
"draws": 3,
"homeWins": 6,
"awayWins": 6,
"avgGolsH2H": 2.3
},
"matchEvents": [{
"eventName": "Card",
"eventType": "Yellow card",
"eventTeam": "Away",
"eventTime": 72,
"eventPlayer": {
"playerName": "Martín Silva",
"playerShortName": "M. Silva",
"playerID": "547DD"
},
"eventSubIn": null,
"eventSubOut": null,
"eventHomeTeam": false
}
]
i have the class but i don t know how to convert from json to gridview
can some one help with an exemple
If you want to do this on server side, here is the solution you need.
As your said, you have class ready or you can create class for your json using http://json2csharp.com (generate c# classes from json)
public class HomeTeamForm
{
public string position { get; set; }
public string points { get; set; }
public List<string> form { get; set; }
}
public class HomeTeamInfo
{
public string homeTeam { get; set; }
public string homeGoals { get; set; }
public string homeGoalsHalfTime { get; set; }
public string homeCorners { get; set; }
public string homeYellowCards { get; set; }
public string homeRedCards { get; set; }
public string homeShotsGol { get; set; }
public string homeShotsFora { get; set; }
public string homeAttacks { get; set; }
public string homeDangerousAttack { get; set; }
public string homePossession { get; set; }
public int homeFouls { get; set; }
public double avgGoalsHome { get; set; }
public string teamID { get; set; }
public HomeTeamForm homeTeamForm { get; set; }
}
public class AwayTeamForm
{
public string position { get; set; }
public string points { get; set; }
public List<string> form { get; set; }
}
public class AwayTeamInfo
{
public string awayTeam { get; set; }
public string awayGoals { get; set; }
public string awayGoalsHalfTime { get; set; }
public string awayCorners { get; set; }
public string awayYellowCards { get; set; }
public string awayRedCards { get; set; }
public string awayShotsGol { get; set; }
public string awayShotsFora { get; set; }
public string awayAttacks { get; set; }
public string awayDangerousAttack { get; set; }
public string awayPossession { get; set; }
public int awayFouls { get; set; }
public double avgGoalsAway { get; set; }
public string teamID { get; set; }
public AwayTeamForm awayTeamForm { get; set; }
}
public class Head2head
{
public int draws { get; set; }
public int homeWins { get; set; }
public int awayWins { get; set; }
public double avgGolsH2H { get; set; }
}
public class EventPlayer
{
public string playerName { get; set; }
public string playerShortName { get; set; }
public string playerID { get; set; }
}
public class MatchEvent
{
public string eventName { get; set; }
public string eventType { get; set; }
public string eventTeam { get; set; }
public int eventTime { get; set; }
public EventPlayer eventPlayer { get; set; }
public object eventSubIn { get; set; }
public object eventSubOut { get; set; }
public bool eventHomeTeam { get; set; }
}
public class RootObject : List<RootObject>
{
public string timeLive { get; set; }
public string halfTimeScore { get; set; }
public object fullTimeScore { get; set; }
public object firstTeamToScore { get; set; }
public HomeTeamInfo homeTeamInfo { get; set; }
public AwayTeamInfo awayTeamInfo { get; set; }
public Head2head head2head { get; set; }
public List<MatchEvent> matchEvents { get; set; }
}
Now you need to Deserialize json to the class.
RootObject myCShartData = new JavaScriptSerializer().Deserialize<RootObject>(json);
Now you are ready to bind gridview using myCShartData variable
I hope you will be helpful
I have a Json response:
{
"external_id": null,
"id": 37974,
"confirmation_number": "355684938",
"state": "unauthorized",
"first_name": "",
"last_name": "mack",
"email": "teja#fareportal.com",
"room_code": null,
"room_description": null,
"start_on": "2014-11-17",
"end_on": "2014-11-18",
"property_id": 666,
"loyalty_number": null,
"average_daily_rate": null,
"room_charges": "$0.00",
"property": {
"id": 666,
"name": "Comfort Inn Gaslamp Convention Center",
"phone": "1 619 238-4100",
"full_address": "660 G Street, San Diego, CA, 92101, US",
"latitude": 32.712823,
"longitude": -117.158607,
"checkout_time": null,
"time_zone": "America/Los_Angeles",
"address": {
"street": "660 G Street",
"city": "San Diego",
"region": "CA",
"postal_code": "92101",
"country_code": "US"
},
"links": [
{
"rel": "vertical_photo",
"href": null,
"version": "retina"
},
{
"rel": "vertical_photo",
"href": null,
"version": "standard"
},
{
"rel": "horizontal_photo",
"href": null,
"version": "retina"
},
{
"rel": "horizontal_photo",
"href": null,
"version": "standard"
},
{
"rel": "reservations",
"href": "https://partners-staging.checkmate.io/properties/666/reservations"
}
]
},
"links": [
{
"rel": "self",
"href": "https://partners-staging.checkmate.io/reservations/37974"
}
]
}
I have to assign the values in class .
I have created the class on http://json2csharp.com/ .
The classes are :
public class Address
{
public string street { get; set; }
public string city { get; set; }
public string region { get; set; }
public string postal_code { get; set; }
public string country_code { get; set; }
}
public class Link
{
public string rel { get; set; }
public string href { get; set; }
public string version { get; set; }
}
public class Property
{
public int id { get; set; }
public string name { get; set; }
public string phone { get; set; }
public string full_address { get; set; }
public double latitude { get; set; }
public double longitude { get; set; }
public object checkout_time { get; set; }
public string time_zone { get; set; }
public Address address { get; set; }
public List<Link> links { get; set; }
}
public class Link2
{
public string rel { get; set; }
public string href { get; set; }
}
public class RootObject
{
public object external_id { get; set; }
public int id { get; set; }
public string confirmation_number { get; set; }
public string state { get; set; }
public string first_name { get; set; }
public string last_name { get; set; }
public string email { get; set; }
public object room_code { get; set; }
public object room_description { get; set; }
public string start_on { get; set; }
public string end_on { get; set; }
public int property_id { get; set; }
public object loyalty_number { get; set; }
public object average_daily_rate { get; set; }
public string room_charges { get; set; }
public Property property { get; set; }
public List<Link2> links { get; set; }
}
How can we de serialize the data from json and assign in those class.
Thanks in advance.
Using JSON.NET
var root = JsonConvert.DeserializeObject<RootObject>(json);
using System.Web.Script.Serialization;
JavaScriptSerializer objectJS = new JavaScriptSerializer();
RootObject objectRootObject = new RootObject();
objectRootObject = objectJS.Deserialize<RootObject>(Your JSon String);
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