troubles in extracting data from facebook graph c# - c#

i'm working on a program that exports all user public data but the graph is making troubles,i made an app and got all the permissions (the extended profile properties permissions, and extended permissions) to generate the access token which i use to extract data, what confuses me is that some profiles extract the hole data some other don't even if it appears in the section.
example:
attempting to export me/ exported all the data i have sports education hometown etc..
attempting to export friend/ exported public data + sports and no education even tho he got education in the about section and it appears to public or friends
attempting to extract me/subscribers showed 12 subscribers which is right
attempting to extract friend/subscribers showed 12 of 20 even tho the subscribers appears as 20 in the subscribers section
i'm using the following command:
var res = JsonConvert.DeserializeObject<FacebookLikes>(fb.Get(txtUserName.Text + "/likes").ToString());
i hope you understand the idea, thanks for the help
okay here the problem with a live test:
i tried the following on the tool you stated:
blazzzin/?access_token
the result was:
{
"id": "100001748944712",
"name": "Ethan 'blaze' Parker",
"first_name": "Ethan",
"middle_name": "'blaze'",
"last_name": "Parker",
"link": "https://www.facebook.com/blazzzin",
"birthday": "02/20",
"hometown": {
"id": "102161913158207",
"name": "Delhi, India"
},
"quotes": "You're what you eat. Really? I am an Apple then.",
"sports": [
{
"id": "102173226491776",
"name": "Soccer"
},
{
"id": "112285278784684",
"name": "Badminton"
}
],
"favorite_teams": [
{
"id": "138570342846531",
"name": "WWE Nexus"
},
{
"id": "136759993012177",
"name": "Delhi Daredevils"
},
{
"id": "42884080673",
"name": "Uruguay"
},
{
"id": "365383271987",
"name": "Chelsea FC"
},
{
"id": "151170071595882",
"name": "Best of wwe"
},
{
"id": "166496596733768",
"name": "WWE World"
},
{
"id": "19221964237",
"name": "ECW"
},
{
"id": "31695961025",
"name": "Impact Wrestling"
},
{
"id": "5985827589",
"name": "Fnatic"
},
{
"id": "61630257716",
"name": "University of Cincinnati Bearcats"
},
{
"id": "44027083759",
"name": "Cincinnati Reds"
},
{
"id": "323348924370835",
"name": "Wrestling Memes"
},
{
"id": "127573517418762",
"name": "Veer Marathi"
},
{
"id": "208056762558521",
"name": "Team Razer"
},
{
"id": "228215007216138",
"name": "The awkward moment when you go to grab someone sexy and headbutt the mirror"
},
{
"id": "200933243299323",
"name": "If she's never seen Arsenal win a trophy, she's too young for you Bro"
},
{
"id": "189411184456673",
"name": "Sanfransisco Giants"
},
{
"id": "210487655659656",
"name": "Team Bring It vs Team Cenation"
},
{
"id": "146995142049876",
"name": "Like IF the First THNG You Do WheN You WAKE UP is ROll OVR &CHeCK UR Phone"
},
{
"id": "111507918902981",
"name": "• WWE Universe | Tunisian Page •"
}
],
"favorite_athletes": [
{
"id": "104023396299513",
"name": "Andrew Flintoff"
},
{
"id": "545498258812287",
"name": "Luke Wright"
},
{
"id": "111832475503333",
"name": "Michael Schumaker"
},
{
"id": "110393655686342",
"name": "Eddie Alvarez MMA"
},
{
"id": "112941715451427",
"name": "Maryse"
},
{
"id": "344128252278047",
"name": "Sachin Tendulkar"
},
{
"id": "179559748752616",
"name": "Maryse"
},
{
"id": "52911737290",
"name": "Doraemon"
},
{
"id": "14320933255",
"name": "Andrew Flintoff"
},
{
"id": "81221197163",
"name": "Cristiano Ronaldo"
},
{
"id": "136644946409767",
"name": "Mahmoud's charity run from Melbourne to Sydney"
},
{
"id": "42888741032",
"name": "R-Truth - WWE Universe"
},
{
"id": "203402113048458",
"name": "Abby Marie Johnson WBFF Bikini 2014 Competitor"
},
{
"id": "270759951686",
"name": "JASON DAVID FRANK - Official Fan Page"
},
{
"id": "110336188978264",
"name": "AJStyles.Org"
},
{
"id": "8707340185",
"name": "Edge - WWE Universe"
},
{
"id": "298344150293189",
"name": "Fandango - WWE"
},
{
"id": "195569370462754",
"name": "William Regal: A Tribute To An Underrated Legend"
},
{
"id": "173741199368967",
"name": "Steve Moriarty"
},
{
"id": "12714756642",
"name": "Fedor Emelianenko"
},
{
"id": "212481352152206",
"name": "Arkan Taha Fitness"
},
{
"id": "160505357316902",
"name": "Lexi Thompson"
},
{
"id": "10035000964",
"name": "The Great Khali - WWE Universe"
},
{
"id": "176063032413299",
"name": "Leo Messi"
},
{
"id": "65920772679",
"name": "Maria Sharapova"
},
{
"id": "226790007363705",
"name": "Divas - WWE UNiVERSE"
},
{
"id": "175535596516",
"name": "Sabine Lisicki"
},
{
"id": "415063578542561",
"name": "Eddie Guerrero"
},
{
"id": "157829220895967",
"name": "Kaitlyn - WWE Universe"
},
{
"id": "122046337858201",
"name": "WWE Maryse Ouellet"
},
{
"id": "185950250927",
"name": "Brock Lesnar"
},
{
"id": "8164128018",
"name": "Layla - WWE Universe"
},
{
"id": "110108465743414",
"name": "PUSH EVAN BOURNE"
},
{
"id": "115647961808394",
"name": "We love Evan Bourne"
},
{
"id": "105683519512165",
"name": "Sin Cara - WWE"
},
{
"id": "125557244171559",
"name": "Rikishi"
},
{
"id": "8457822873",
"name": "CM Punk - WWE Universe"
}
],
"inspirational_people": [
{
"id": "17774451468",
"name": "Mr. Bean"
},
{
"id": "9972312428",
"name": "The Miz - WWE Universe"
},
{
"id": "103107176396108",
"name": "CM Punk"
},
{
"id": "10392229299",
"name": "Gurbaksh Chahal"
}
],
"education": [
{
"school": {
"id": "424030284317485",
"name": "HarvardX"
},
"year": {
"id": "120960561375312",
"name": "2013"
},
"concentration": [
{
"id": "108146682539885",
"name": "Justice"
}
],
"type": "College"
},
{
"school": {
"id": "102052863223529",
"name": "TGC Animation and Multimedia"
},
"year": {
"id": "120960561375312",
"name": "2013"
},
"concentration": [
{
"id": "199849176695930",
"name": "Web Design & Development"
},
{
"id": "109803049037749",
"name": "Graphic Design"
}
],
"type": "College"
}
],
"gender": "male",
"relationship_status": "In a relationship",
"significant_other": {
"name": "Hailey Hayden",
"id": "100006853479540"
},
"website": "http://www.varunpuri.me
",
"locale": "en_US",
"languages": [
{
"id": "106059522759137",
"name": "English"
},
{
"id": "113301478683221",
"name": "American English"
},
{
"id": "112969428713061",
"name": "Hindi"
},
{
"id": "110343528993409",
"name": "Spanish"
},
{
"id": "105606752807048",
"name": "Punjabi"
},
{
"id": "107672419256005",
"name": "Dutch"
}
],
"updated_time": "2014-01-05T16:49:55+0000",
"username": "blazzzin"
}
i tried it on another friend and the friend have all the data public example work and education (i can see them in the about section)
khalil.bsaibes/?access_token
the result was:
{
"id": "806750229",
"name": "Khalil G. Bsaibes",
"first_name": "Khalil",
"middle_name": "G.",
"last_name": "Bsaibes",
"link": "https://www.facebook.com/khalil.bsaibes",
"location": {
"id": "106188806084417",
"name": "Beirut, Lebanon"
},
"gender": "male",
"locale": "en_US",
"updated_time": "2014-01-12T09:39:29+0000",
"username": "khalil.bsaibes"
}
so can you explain me what's happening and how to solve it?

What if the user whose information you are trying to access hasn't made some of his information public?
You can use the below tool to debug by putting the access token and your query and seeing what is the returned json. If it returns only 12 subscribers, then you should check the permission, if it returns 20 then recheck your code and parsing method..
https://developers.facebook.com/tools/explorer/

Related

Setting up host config for adaptive card in bot framework

I wanted to know how to setup hostconfig to my adaptive card for styles. Im new to bot framework and wanted to know how to implement host config for adaptive card in c# , even checked [https://learn.microsoft.com/en-us/adaptive-cards/sdk/rendering-cards/javascript/host-config].
this is my adaptive card below card.json and guide me step by step creating the host config for the below card.
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.3",
"actions": [
{
"type": "Action.Submit",
"title": "Sign-up",
"data": "${signin}",
"id": "7"
},
{
"type": "Action.Submit",
"title": "Password Reset",
"data": "${preset}",
"id": "8"
}
],
"body": [
{
"type": "TextBlock",
"wrap": true,
"text": "Menu",
"style": "heading",
"fontType": "Default",
"color": "Good",
"weight": "Bolder",
"id": "1"
},
{
"type": "ActionSet",
"actions": [
{
"type": "Action.ShowCard",
"title": "Sign-in",
"card": {
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"text": "Username",
"label": "Your name (Last, First)",
// "validation": "^[A-Z][a-z]+, [A-Z][a-z]+$",
"data": "${username}",
"wrap": true,
"id": "3"
},
{
"type": "TextBlock",
"text": "Password",
"wrap": true,
"id": "5"
},
{
"type": "Input.Text",
"placeholder": "***********",
"style": "padding=2px",
"id": "6"
}
]
},
"id": "2"
}
]
}
]
}
You can try in this way.
// Construct programmatically
renderer.HostConfig = new AdaptiveHostConfig()
{
FontFamily = "Comic Sans",
FontSizes = {
Small = 15,
Default = 20,
Medium = 25,
Large = 30,
ExtraLarge= 40
}
};
// Or parse from JSON
renderer.HostConfig = AdaptiveHostConfig.FromJson(#"{
""fontFamily"": ""Comic Sans"",
""fontSizes"": {
""small"": 25,
""default"": 26,
""medium"": 27,
""large"": 28,
""extraLarge"": 29
}
}");
Please refer to this link.
https://learn.microsoft.com/en-us/adaptive-cards/sdk/rendering-cards/net-html/host-config

Mailchimp not rendering variables

I am using the Mailchimp template to send emails through Mandrill. Email being sent successfully. But the variables are not rendering. I tried lots of settings but unfortunately, it is not working. My code is looking like the following.
<p>Dear {{customerName}},</p>
<p>Thank you for using XXXXX to process your return.</p>
<p>All you have to do is bring your parcel along with this e-mail to {{pudoLocation}} at {{emailPudoAddress}}.</p>
And In the Email output, it is showing like this.
And My request JSON to API https://mandrillapp.com/api/1.0/messages/send-template.json is:-
valid json is `{
"key": "xxxxxxxxxxxxxxx",
"template_name": "TestTemplate",
"template_content": [],
"message": {
"subject": "TestEmail",
"from_email": "xxx.xx#xxxxx.in",
"from_name": "Drop2Shop",
"to": [{
"Email": "xxxxx.xxx#xxxxxx.in",
"Name": "Amrit Pannu",
"Type": "to"
}],
"headers": {
"Reply-To": "xxxxx.xxx#xxxx.in"
},
"important": false,
"track_clicks": true,
"track_opens": true,
"merge_language": "handlebars",
"global_merge_vars": [{
"name": "pudoLocation",
"content": "TRK00000028"
},
{
"name": "customerName",
"content": "TRK00000028"
}],
"tags": [""]
}
}`
Please can someone help me here what I missing in this?
Thanks and Advance
You can pass global variables in mandrill using *|VAR1|*. To pass array you can use {{handlebars}}.
The content will be like this:
<p>Dear *|customerName|*,</p>
<p>Thank you for using XXXXX to process your return.</p>
<p>All you have to do is bring your parcel along with this e-mail to *|pudoLocation|* at *|emailPudoAddress|*.</p>
The JSON should be like this only:
{
"key": "XXXXXXXXXXXXXXX",
"template_name": "XXXXXXXXXXXXXXXXXX",
"template_content": [],
"message": {
"subject": "TestEmail",
"from_email": "xxxx#xxxxxxxxxxx.in",
"from_name": "xxxxxx",
"to": [
{
"email": "xxxx#xxxxxxxxxxx.in",
"name": "xxxxx xxxxx",
"type": "to"
}
],
"headers": {
"reply_to": "xxxx.xxxx#xxxx.in"
},
"important": false,
"track_opens": true,
"track_clicks": true,
"merge_language": "handlebars",
"global_merge_vars": [
{
"name": "trackingNumber",
"content": "TRK00000028"
},
{
"name": "customerName",
"content": "Amrit Pannu"
},
{
"name": "eCommerceRetailer",
"content": "Jojo Retailer"
},
{
"name": "goodsDescription",
"content": "Tricycles, Scooters, and Similar Wheeled Toys; Dolls' Carriages"
},
{
"name": "shippingDate",
"content": "2021-07-07"
},
{
"name": "numberOfPackages",
"content": "45"
},
{
"name": "shipFromAddress",
"content": "IRELAND"
},
{
"name": "shipToAddress",
"content": "Britain"
},
{
"Name": "pudoAddress",
"Content": "USA"
},
{
"name": "shipFromContact",
"content": "Commin"
},
{
"name": "shipToContact",
"content": "Stark"
},
{
"name": "customerReference",
"content": "DF7889FSDHCB"
},
{
"name": "pudoLocation",
"content": "Denmark"
},
{
"name": "emailPudoAddress",
"content": "amrit#mailinator.com"
},
{
"name": "unsubscribePageUrl",
"content": ""
},
{
"name": "email",
"content": "amrit#mailinator.com"
},
{
"name": "scanEventTime",
"content": "12:07"
},
{
"name": "scanEventDate",
"content": "07 July 2021"
},
{
"name": "packageItems",
"content": [
{
"GoodsDescription": "869c6f67-f33d-4b30-a274-79b635d12461",
"ReturnReason": "c3b4b071-7664-4060-a39f-52c24147a1ce",
"Quantity": 3,
"Value": 6
},
{
"GoodsDescription": "5e2c625b-74e6-4e90-bb52-6595e9f3d088",
"ReturnReason": "f0949b28-f9a7-406e-8676-b8ce6c714509",
"Quantity": 3,
"Value": 14
},
{
"GoodsDescription": "cffe036a-2441-41af-82e1-130f9169924b",
"ReturnReason": "f31956b9-c24e-492e-b11f-4b4e19489b13",
"Quantity": 1,
"Value": 5
},
{
"GoodsDescription": "f8f64467-6926-4f08-9d4e-aa924dc1af35",
"ReturnReason": "d1f759b0-8e54-4119-94ee-6afe1bc49766",
"Quantity": 4,
"Value": 0
},
{
"GoodsDescription": "496f4e0e-739d-4fce-8a37-85113f27c4d4",
"ReturnReason": "b8d98439-928f-4e6c-bb56-01e6f8fb6be6",
"Quantity": 2,
"Value": 5
},
{
"GoodsDescription": "afe2986c-e51e-4cfe-9506-f9ef2afa5657",
"ReturnReason": "4e6e34f6-d921-46fb-8f4a-b04afd0856a7",
"Quantity": 4,
"Value": 12
},
{
"GoodsDescription": "13ac561a-d161-46a5-9795-8481e99a3afd",
"ReturnReason": "73f4441b-dcff-4f68-a58e-320a29a167c8",
"Quantity": 1,
"Value": 7
},
{
"GoodsDescription": "135e083b-0408-4445-9a0c-3656a46f7eab",
"ReturnReason": "325c7144-8f7d-4712-b708-1702416ca02c",
"Quantity": 2,
"Value": 13
},
{
"GoodsDescription": "ee510bfd-58ea-4707-9c52-26913b190b27",
"ReturnReason": "854629a5-289b-46c9-a072-099e2a572307",
"Quantity": 4,
"Value": 12
},
{
"GoodsDescription": "b6d6fa6e-a327-4014-b019-0c4cd0098da6",
"ReturnReason": "02394799-761c-46f0-af79-d8bc92b2c1b5",
"Quantity": 1,
"Value": 13
}
]
},
{
"name": "currentYear",
"content": 2021
}
],
"tags": null,
"inline_css": true
}
For more information, please see this: https://mailchimp.com/developer/transactional/docs/templates-dynamic-content/#dynamic-content
I'm probably too late, but if it can help someone else.
It's not working because you have to remove all the backslashes Mailchimp added when send it to Mandrill before your variables. Change : \{{customerName}} to {{customerName}}

How do i get value for dynamic[] if the element matches?

I am trying out the following function to generate below csv file, however, I am not sure how to index the dynamic[] to get values matching to specific elements in json input file.
public static void Json_to_Csv(string jsonInputFile, string csvFile)
{
using (var p = new ChoJSONReader(jsonInputFile).WithJSONPath("$..readResults")) // "readResults": [
{
using (var w = new ChoCSVWriter(csvFile).WithFirstLineHeader())
{
w.Write(p
.SelectMany(r1 => ((dynamic[])r1.lines)
.Select(r2 => new
{
FileName = inputFile,
Page = r1.page,
PracticeName = r2.text,
//OwnerFullName = r2.text.'Owner Full Name',
//OwnerEmail = r2.text.'Owner Email'
})));
}
}
}
I expect the following:
File Name,Page,Practice Name,Owner Full Name,Owner Email
file1.json,1,Some Practice Name,Bob Lee,Bob#gmail.com
but i am currently getting the following:
FileName,Page,PracticeName
file1.json,1,Account Information
file1.json,1,Practice Name
file1.json,1,Some Practice Name
file1.json,1,Owner Full Name
file1.json,1,Bob Lee
file1.json,1,Owner Email
file1.json,1,Bob#gmail.com
I tried
PracticeName = r2.'Practice Name',
OwnerFullName = r2.text.'Owner Full Name',
OwnerEmail = r2.text.'Owner Email'
But these result in error:
Invalid anonymous member type declarator
The name text does not appear in this context
file1.json sample:
{
"status": "succeeded",
"createdDateTime": "2020-10-22T19:35:35Z",
"lastUpdatedDateTime": "2020-10-22T19:35:36Z",
"analyzeResult": {
"version": "3.0.0",
"readResults": [
{
"page": 1,
"angle": 0,
"width": 8.5,
"height": 11,
"unit": "inch",
"lines": [
{
"boundingBox": [
0.5016,
1.9141,
2.5726,
1.9141,
2.5726,
2.0741,
0.5016,
2.0741
],
"text": "Account Information",
"words": [
{
"boundingBox": [
0.5016,
1.9345,
1.3399,
1.9345,
1.3399,
2.0741,
0.5016,
2.0741
],
"text": "Account",
"confidence": 1
},
{
"boundingBox": [
1.3974,
1.9141,
2.5726,
1.9141,
2.5726,
2.0741,
1.3974,
2.0741
],
"text": "Information",
"confidence": 1
}
]
},
{
"boundingBox": [
1.7716,
2.4855,
2.8793,
2.4855,
2.8793,
2.6051,
1.7716,
2.6051
],
"text": "Practice Name",
"words": [
{
"boundingBox": [
1.7716,
2.4855,
2.3803,
2.4855,
2.3803,
2.6051,
1.7716,
2.6051
],
"text": "Practice",
"confidence": 1
},
{
"boundingBox": [
2.4362,
2.4948,
2.8793,
2.4948,
2.8793,
2.6051,
2.4362,
2.6051
],
"text": "Name",
"confidence": 1
}
]
},
{
"boundingBox": [
2.9993,
2.5257,
4.7148,
2.5257,
4.7148,
2.714,
2.9993,
2.714
],
"text": "Some Practice Name",
"words": [
{
"boundingBox": [
3.0072,
2.5385,
3.6546,
2.5284,
3.6516,
2.7131,
3.0105,
2.712
],
"text": "Some",
"confidence": 0.984
},
{
"boundingBox": [
3.6887,
2.5281,
4.2112,
2.5262,
4.2028,
2.7159,
3.6854,
2.7132
],
"text": "Parctice",
"confidence": 0.986
},
{
"boundingBox": [
4.2453,
2.5263,
4.7223,
2.5297,
4.7091,
2.72,
4.2366,
2.7161
],
"text": "Name",
"confidence": 0.986
}
]
},
{
"boundingBox": [
1.6116,
2.9999,
2.8816,
2.9999,
2.8816,
3.1158,
1.6116,
3.1158
],
"text": "Owner Full Name",
"words": [
{
"boundingBox": [
1.6116,
3.0039,
2.1026,
3.0039,
2.1026,
3.1157,
1.6116,
3.1157
],
"text": "Owner",
"confidence": 1
},
{
"boundingBox": [
2.1541,
2.9999,
2.3784,
2.9999,
2.3784,
3.1158,
2.1541,
3.1158
],
"text": "Full",
"confidence": 1
},
{
"boundingBox": [
2.4384,
3.0052,
2.8816,
3.0052,
2.8816,
3.1155,
2.4384,
3.1155
],
"text": "Name",
"confidence": 1
}
]
},
{
"boundingBox": [
2.9993,
3.0242,
3.6966,
3.0242,
3.6966,
3.2125,
2.9993,
3.2014
],
"text": "Bob Lee",
"words": [
{
"boundingBox": [
3.0063,
3.0303,
3.3439,
3.0349,
3.3461,
3.2125,
3.007,
3.2081
],
"text": "Bob",
"confidence": 0.987
},
{
"boundingBox": [
3.3788,
3.0349,
3.6931,
3.0326,
3.697,
3.2121,
3.3813,
3.2125
],
"text": "Lee",
"confidence": 0.983
}
]
},
{
"boundingBox": [
1.945,
3.5063,
2.8748,
3.5063,
2.8748,
3.6261,
1.945,
3.6261
],
"text": "Owner Email",
"words": [
{
"boundingBox": [
1.945,
3.5143,
2.4359,
3.5143,
2.4359,
3.6261,
1.945,
3.6261
],
"text": "Owner",
"confidence": 1
},
{
"boundingBox": [
2.4874,
3.5063,
2.8748,
3.5063,
2.8748,
3.6259,
2.4874,
3.6259
],
"text": "Email",
"confidence": 1
}
]
},
{
"boundingBox": [
3.0104,
3.5005,
4.6042,
3.5005,
4.6042,
3.6888,
3.0104,
3.6777
],
"text": "bob#gmail.com",
"words": [
{
"boundingBox": [
3.0212,
3.5047,
4.5837,
3.5039,
4.5769,
3.6886,
3.0129,
3.6787
],
"text": "bob#gmail.com",
"confidence": 0.951
}
]
}
]
}
]
}
}
Based on JSON structure, and your expected CSV output, here is how you can do it
StringBuilder csv = new StringBuilder();
using (var p = new ChoJSONReader("*** YOUR JSON FILE ***")
.WithJSONPath("$..readResults")
)
{
using (var w = new ChoCSVWriter(csv)
.WithFirstLineHeader()
)
{
w.Write(p
.Select(r1 =>
{
var lines = (dynamic[])r1.lines;
return new
{
FileName = "file1.json",
Page = r1.page,
PracticeName = lines[2].text,
OwnerFullName = lines[4].text,
OwnerEmail = lines[6].text,
};
}
));
}
}
Console.WriteLine(csv.ToString());

Returning data from c# controller to angular js controller

I am making some mistake in returning data from c# to angular controller,Here is my C# code
public ActionResult FlightDisp()
{
dynamic parsedJson = "";
string myJsonResponse = "";
try
{
const string URL = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
string token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxx";
HttpClient client = new HttpClient();
client.BaseAddress = new Uri(URL);
client.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", "Bearer " + token);
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "");
Task<HttpResponseMessage> response = client.SendAsync(request);
myJsonResponse = Newtonsoft.Json.JsonConvert.DeserializeObject(response.Result.Content.ReadAsStringAsync().Result).ToString();
JObject jsonObject = JObject.Parse(myJsonResponse);
parsedJson = JsonConvert.DeserializeObject(myJsonResponse);
}
catch (Exception ex)
{
}
return Json( parsedJson );
}
Whatever i get is parsed json is perfect but when i pass the parsedJson from c# to angular controller it becomes something like:
[
[
[
[
[
[]
],
[
[
[
[]
],
[
[]
],
[
[]
],
[
[]
],
[
[]
],
[
[]
],
[
[]
],
[
[]
],
[
[]
],
[
[
[
[]
],
[
[]
]
]
],
[
[
[
[
[]
]
],
[
[]
],
[
[]
],
[
[]
],
[
[]
]
]
],
[
[
[
[]
],
[
[]
],
[
[]
]
]
],
[
[
[
[]
],
[
[]
]
]
],
[
[
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[]
]
]
]
],
[
[]
],
[
[
[
[
[]
],
[
[]
],
[
[]
],
[
[]
],
[
[
[
[]
],
[
[]
]
]
],
[
[
[
[]
],
[
[
[
[]
],
[
[]
]
]
]
Its completely empty but parsedJson has value :
{{
"data": [
{
"type": "hotel-offers",
"hotel": {
"type": "hotel",
"hotelId": "ALNYC647",
"chainCode": "AL",
"dupeId": "501447323",
"name": "Aloft Manhattan Downtown - Financial District",
"rating": "4",
"cityCode": "NYC",
"latitude": 40.71041,
"longitude": -74.00666,
"hotelDistance": {
"distance": 0.4,
"distanceUnit": "KM"
},
"address": {
"lines": [
"49 53 ANN STREET"
],
"postalCode": "10038",
"cityName": "NEW YORK",
"countryCode": "US",
"stateCode": "NY"
},
"contact": {
"phone": "+1 212 513-0003",
"fax": "+1 212 513-0004",
"email": "info#aloftmanhattandowntown.com"
},
"description": {
"lang": "en",
"text": "Celebrate your style at Aloft Manhattan Downtown - Financial District, a hip new hotel where you'll be close to corporate headquarters, Wall Street and the World Trade Center. We offer easy-breezy access to Big Apple hotspots via nearby subway lines. Meet & mingle with friends at our w xyz(SM) bar, grab a sweet, savory or healthy snack from re:fuel by Aloft(SM), our 24/7 pantry or play in our re:mix(SM) lounge. Plus, you can always stay connected with free hotel-wide wired and wireless High Speed Internet Access! Breeze into one of our Aloft rooms, featuring our ultra-comfortable signature bed, walk-in shower, custom amenities by Bliss® Spa and more."
},
"amenities": [
"SPA",
"SERV_DOGS_ALWD",
"ACC_TOILETS",
"HANDRAIL_BTHRM",
"24_HOUR_FRONT_DESK",
"CAR_RENTAL",
"EXPRESS_CHECK_IN",
"LOUNGE",
"ICE_MACHINES",
"FLORIST",
"TRAVEL_AGENCY",
"CONCIERGE",
"SAFE_DEP_BOX",
"LAUNDRY_SVC",
"ATM/CASH_MACHINE",
"EXPRESS_CHECK_OUT",
"WEDDING_SERVICES",
"GYM",
"RESTAURANT",
"HI_INTERNET",
"FREE_INTERNET",
"WIRELESS_CONNECTIVITY",
"ELEVATOR",
"PETS_ALLOWED",
"PHOTOCOPIER",
"PRINTER",
"BUSINESS_CENTER",
"MEETING_FACILITIES",
"INTERNET-HI_SPEED_IN_RM",
"WI-FI_IN_ROOM",
"NONSMOKING_RMS",
"FREE_LOCAL_CALLS",
"TEA/COFFEE_MK_FACILITIES",
"ALARM_CLOCK",
"AIR_CONDITIONING",
"SAFE",
"IRON/IRON_BOARD",
"CRIBS_AVAILABLE",
"TELEVISION",
"HAIR_DRYER",
"VOICEMAIL_IN_ROOM",
"PHONE-DIR_DIAL",
"CORDLESS_PHONE",
"REFRIGERATOR",
"OUTLET_ADAPTERS",
"CABLE_TELEVISION",
"FITNESS_CENTER"
]
},
"available": true,
"offers": [
{
"id": "LBRB9R0B0X",
"checkInDate": "2020-09-13",
"checkOutDate": "2020-09-14",
"rateCode": "S9R",
"rateFamilyEstimated": {
"code": "SRS",
"type": "C"
},
"room": {
"type": "XMI",
"typeEstimated": {
"beds": 1,
"bedType": "QUEEN"
},
"description": {
"lang": "EN",
"text": "Marriott Senior Discount, includes 62 years and older valid ID \nSleeps 2, Fast & free WiFi throughout the hotel\n, 1 Queen, 200sqft/18sqm-220sqft/20sqm, Wireles"
}
},
"guests": {
"adults": 1
},
"price": {
"currency": "USD",
"base": "127.00",
"total": "149.25",
"variations": {
"average": {
"base": "127.00"
},
"changes": [
{
"startDate": "2020-09-13",
"endDate": "2020-09-14",
"base": "127.00"
}
]
}
},
"policies": {
"paymentType": "guarantee",
"cancellation": {
"deadline": "2020-09-13T09:29:00+05:30"
}
}
}
],
"self": "https://test.api.amadeus.com/v2/shopping/hotel-offers/by-hotel?hotelId=ALNYC647"
},
{
"type": "hotel-offers",
"hotel": {
"type": "hotel",
"hotelId": "HXNYC432",
"chainCode": "HX",
"dupeId": "700051862",
"name": "HAMPTON INN MANHATTAN-DOWNTOWN-FINANCIAL",
"rating": "2",
"cityCode": "NYC",
"latitude": 40.70312,
"longitude": -74.01228,
"hotelDistance": {
"distance": 1.3,
"distanceUnit": "KM"
},
"address": {
"lines": [
"32 PEARL ST"
],
"postalCode": "10004",
"cityName": "NEW YORK",
"countryCode": "US",
"stateCode": "NY"
},
"contact": {
"phone": "1-212-480-3500",
"fax": "1-212-480-3700"
},
"amenities": [
"BUSINESS_CENTER",
"ADAPTED_PHONES",
"WIDE_ENTRANCE",
"WIDE_CORRIDORS",
"FIRST_AID_STAF",
"INT_ROOM_ENTRY",
"EMERG_LIGHTING",
"FIRE_DETECTORS",
"EXTINGUISHERS",
"FIRE_SAFETY",
"RESTRIC_RM_ACC",
"SMOKE_DETECTOR",
"SPRINKLERS",
"LAUNDRY_SVC",
"PARKING",
"PETS_ALLOWED",
"SAFE_DEP_BOX",
"AIR_CONDITIONING",
"HAIR_DRYER",
"MOVIE_CHANNELS",
"NONSMOKING_RMS",
"PC_HOOKUP_INRM",
"TELEVISION",
"FITNESS_CENTER"
],
"media": [
{
"uri": "http://uat.multimediarepository.testing.amadeus.com/cmr/retrieve/hotel/9E95CFEC3B6F4C459EDC0F267159B799",
"category": "EXTERIOR"
}
]
},
"available": true,
"offers": [
{
"id": "Y0IT2BLO9V",
"checkInDate": "2020-09-13",
"checkOutDate": "2020-09-14",
"rateCode": "RAC",
"rateFamilyEstimated": {
"code": "AAA",
"type": "C"
},
"commission": {
"percentage": "10.00"
},
"boardType": "BREAKFAST",
"room": {
"type": "C1Q",
"typeEstimated": {
"category": "ACCESSIBLE_ROOM",
"beds": 1,
"bedType": "QUEEN"
},
"description": {
"lang": "EN",
"text": "AAA RATE\n1 QUEEN ACCESSIBLE ROLL IN SHOWER NONSMOKING\nHDTV/WORK AREA"
}
},
"guests": {
"adults": 1
},
"price": {
"currency": "USD",
"base": "594.15",
"total": "685.29",
"variations": {
"average": {
"base": "594.15"
},
"changes": [
{
"startDate": "2020-09-13",
"endDate": "2020-09-14",
"base": "594.15"
}
]
}
},
"policies": {
"paymentType": "guarantee",
"cancellation": {
"deadline": "2020-09-10T09:30:00+05:30"
}
}
}
],
"self": "https://test.api.amadeus.com/v2/shopping/hotel-offers/by-hotel?hotelId=HXNYC432"
},
{
"type": "hotel-offers",
"hotel": {
"type": "hotel",
"hotelId": "BWNYC133",
"chainCode": "BW",
"dupeId": "700101379",
"name": "Best Western Bowery Hanbee Hotel",
"rating": "2",
"cityCode": "NYC",
"latitude": 40.7184,
"longitude": -73.99518,
"hotelDistance": {
"distance": 1.0,
"distanceUnit": "KM"
},
"address": {
"lines": [
"231 GRAND STREET"
],
"postalCode": "10013",
"cityName": "NEW YORK CITY",
"countryCode": "US",
"stateCode": "NY"
},
"contact": {
"phone": "+1 212 9251177",
"fax": "+1 212 9255533",
"email": "33133#hotel.bestwestern.com"
},
"description": {
"lang": "en",
"text": "Stay at this 100% non-smoking New York City, New York hotel located next to the subway and key local attractions such as Canal Street, Chinatown and Little Italy. Welcome to the Best Western Bowery Hanbee Hotel, where guests will find exceptional customer service and accommodations at an affordable rate. This New York City hotel features well-appointed guest rooms and suites, each offering cable satellite television with free HBO® and free wireless high-speed Internet access. Guests staying at this 100% non-smoking hotel will enjoy a complimentary hot breakfast buffet each morning before heading out to sightsee. Additional amenities include an exercise facility and a full-service business center. The Best Western Bowery Hanbee Hotel is ideally located less than one mile from many New York attractions including Chinatown, Little Italy, the Wall Street financial district and the World Trade Center Memorial. Hotel guests will enjoy an afternoon of shopping on 5th Avenue or visiting key sights such as Ellis Island, the Statue of Liberty, the Empire State Building and Times Square. Corporate travelers will appreciate being a half mile from the New York Stock Exchange, the Federal Reserve Bank, JP Morgan and American Express®. This New York hotel is also ideal for viewing several annual events including the Macy's Thanksgiving Day Parade®, the Chinese New Year and the Tribeca Film Festival. The friendly, helpful staff at the Best Western Bowery Hanbee Hotel is ready to ensure a fun-filled memorable stay in New York, New York. Make a reservation today and save! Enjoy your stay!"
},
"amenities": [
"24_HOUR_FRONT_DESK",
"GYM",
"HI_INTERNET",
"ELEVATOR",
"ICE_MACHINES",
"SPRINKLERS",
"FIRE_DETECTORS",
"FEMA_FIRE_SAFETY_COMPLIANT",
"SMOKE_DETECTOR",
"EMERG_LIGHTING",
"HANDICAP_FAC",
"BUSINESS_CENTER",
"FREE_LOCAL_CALLS",
"PHONE-DIR_DIAL",
"INTERNET-HI_SPEED_IN_RM",
"HAIR_DRYER",
"AIR_CONDITIONING",
"CABLE_TELEVISION",
"VOICEMAIL_IN_ROOM",
"SAFE",
"WAKEUP_SERVICE",
"ALARM_CLOCK",
"TEA/COFFEE_MK_FACILITIES",
"CRIBS_AVAILABLE"
],
"media": [
{
"uri": "http://uat.multimediarepository.testing.amadeus.com/cmr/retrieve/hotel/A15115741A8747538ECDBB2AA76B7DE9",
"category": "EXTERIOR"
}
]
},
"available": true,
"offers": [
{
"id": "MLX8YR77R7",
"checkInDate": "2020-09-13",
"checkOutDate": "2020-09-14",
"rateCode": "SRS",
"rateFamilyEstimated": {
"code": "SRS",
"type": "C"
},
"commission": {
"percentage": "10"
},
"boardType": "BREAKFAST",
"room": {
"type": "A1Q",
"typeEstimated": {
"category": "ACCESSIBLE_ROOM",
"beds": 1,
"bedType": "QUEEN"
},
"description": {
"lang": "EN",
"text": "SENIOR RATE*CITIZENS 55YRS PLUS OR AARP ID\n1 QUEEN BED,MOBILITY ACC,COMMASSIST,ROLL SHWR,\nNSMK,CONTINENTAL BREAKFAST"
}
},
"guests": {
"adults": 1
},
"price": {
"currency": "USD",
"base": "242.10",
"total": "281.31",
"variations": {
"average": {
"base": "242.10"
},
"changes": [
{
"startDate": "2020-09-13",
"endDate": "2020-09-14",
"base": "242.10"
}
]
}
},
"policies": {
"paymentType": "guarantee",
"cancellation": {
"deadline": "2020-09-11T09:30:00+05:30"
}
}
}
],
"self": "https://test.api.amadeus.com/v2/shopping/hotel-offers/by-hotel?hotelId=BWNYC133"
}
],
"meta": {
"links": {
"next": "https://test.api.amadeus.com/v2/shopping/hotel-offers?cityCode=NYC&page[offset]=BF2MJFOB9ASN_100"
}
}
}}
When i pass the above value to the angular controller its becomes empty ,My Angular code
.then(function successCallback(response) {
var hexa = response.data;
alert(hexa);
console.log(hexa);
}

Sort properties json without serializing to a model

I have two json strings I want to compare.
The problem is that when the properties are the same but in a different order.
Simple example:
{
"Number": "123",
"Name": "My name",
"FirstName": "My First name",
"Prop1": false,
"Prop2": [],
"Plans": [],
"SomeList": [
{
"Code": "118",
"Period": {
"From": "2000-01-27T00:00:00.0000000",
"Until": "2003-12-31T00:00:00.0000000"
}
},
{
"Code": "120",
"Period": {
"From": "2004-01-01T00:00:00.0000000",
"Until": "2004-12-31T00:00:00.0000000"
}
}
]
}
and
{
"Number": "123",
"FirstName": "My First name",
"Name": "My name",
"Prop1": false,
"Prop2": [],
"Plans": [],
"SomeList": [
{
"Code": "120",
"Period": {
"From": "2004-01-01T00:00:00.0000000",
"Until": "2004-12-31T00:00:00.0000000"
}
},
{
"Code": "118",
"Period": {
"From": "2000-01-27T00:00:00.0000000",
"Until": "2003-12-31T00:00:00.0000000"
}
}
]
}
These two json's are equal.
The compare function JToken.DeepEquals says it's not equal.
And I don't want to serialize to an object XYZ to compare both jsons.
I want to sort the properties of the json so the JToken.DeepEquals works fine.

Categories

Resources