im trying to scrape the info from www.kimovil.com and i have one issue with the prices.
i want to scrapy only this price -->
field to read
but when i inspect that i see what is a list with diferent country prices an by default the first on read is the germany price so i got 989€ instead 1090
Inspector view
how can i scrapy the spanish price???
Why don't you try using requests by accessing the kimovil API instead of scrapy? Here's something to start with:
import requests
import re
PHONE_MODEL = 'realme GT 2 Pro'
response = requests.get('https://www.kimovil.com/_json/{}_prices_deals.json'.format(re.sub("\s", "-", PHONE_MODEL.lower())))
print(response.text)
The endpoint you're looking for has the following structure:
https://www.kimovil.com/_json/<name-of-the-phone>_prices_deals.json
I tested it with a couple of phone models and it works just fine. You just have to update the PHONE_MODEL to match the name of the phone as it shows on their page.
This is how the response would look like:
{
"prices":[
{
"device_id":10999,
"id":2193117,
"originalPrice":"628.17",
"originalCurrency":"EUR",
"shortHash":"https:\/\/www.kimovil.com\/to\/XFF8R3",
"hash":"XFF8R3",
"provider":{
"id":522,
"provider_group_id":525,
"countryDeliveryTo":{
"countryCode":"XX"
},
"destinationCountries":[
"US",
"RU",
"BR",
"CO",
"PE",
"MX"
],
"country_sale_restriction":[
"BR",
"MX",
"RU",
"PE"
],
"warehouse_country_code":"CN"
},
"eurPrice":"628.17",
"gbpPrice":"525.89",
"usdPrice":"644.81",
"rubPrice":"41659.90",
"inrPrice":"50897.95",
"plnPrice":"2962.73",
"brlPrice":"3342.91",
"mxnPrice":"13142.91"
},
{
"device_id":10999,
"id":2076448,
"originalPrice":"638.40",
"originalCurrency":"EUR",
"shortHash":"https:\/\/www.kimovil.com\/to\/273TTX",
"hash":"273TTX",
"provider":{
"id":684,
"provider_group_id":536,
"countryDeliveryTo":{
"countryCode":"XX"
},
"destinationCountries":[
"XX"
],
"country_sale_restriction":[
],
"warehouse_country_code":"CN"
},
"eurPrice":"638.40",
"gbpPrice":"533.62",
"usdPrice":"649.06",
"rubPrice":"39420.09",
"inrPrice":"51005.78",
"plnPrice":"3014.28",
"brlPrice":"3425.62",
"mxnPrice":"13485.12"
},
{
"device_id":10999,
"id":2040143,
"originalPrice":"683.00",
"originalCurrency":"EUR",
"shortHash":"https:\/\/www.kimovil.com\/to\/6R5HNG",
"hash":"6R5HNG",
"provider":{
"id":528,
"provider_group_id":394,
"countryDeliveryTo":{
"countryCode":"XX"
},
"destinationCountries":[
"XX"
],
"country_sale_restriction":[
],
"warehouse_country_code":"CN"
},
"eurPrice":"683.00",
"gbpPrice":"570.90",
"usdPrice":"694.41",
"rubPrice":"42174.06",
"inrPrice":"54569.15",
"plnPrice":"3224.87",
"brlPrice":"3664.94",
"mxnPrice":"14427.22"
},
{
"device_id":10999,
"id":2077019,
"originalPrice":"722.69",
"originalCurrency":"EUR",
"shortHash":"https:\/\/www.kimovil.com\/to\/B4Z2BF",
"hash":"B4Z2BF",
"provider":{
"id":688,
"provider_group_id":11,
"countryDeliveryTo":{
"countryCode":"XX"
},
"destinationCountries":[
"US",
"RU",
"BR",
"CO",
"PE",
"MX"
],
"country_sale_restriction":[
"BR",
"MX",
"RU",
"PE"
],
"warehouse_country_code":"CN"
},
"eurPrice":"722.69",
"gbpPrice":"605.02",
"usdPrice":"741.83",
"rubPrice":"47928.41",
"inrPrice":"58556.51",
"plnPrice":"3408.52",
"brlPrice":"3845.92",
"mxnPrice":"15120.50"
},
{
"device_id":10999,
"id":2077027,
"originalPrice":"722.69",
"originalCurrency":"EUR",
"shortHash":"https:\/\/www.kimovil.com\/to\/3N2PL8",
"hash":"3N2PL8",
"provider":{
"id":646,
"provider_group_id":11,
"countryDeliveryTo":{
"countryCode":"XX"
},
"destinationCountries":[
"US",
"RU",
"BR",
"CO",
"PE",
"MX"
],
"country_sale_restriction":[
"BR",
"MX",
"RU",
"PE"
],
"warehouse_country_code":"CN"
},
"eurPrice":"722.69",
"gbpPrice":"605.02",
"usdPrice":"741.83",
"rubPrice":"47928.41",
"inrPrice":"58556.51",
"plnPrice":"3408.52",
"brlPrice":"3845.92",
"mxnPrice":"15120.50"
},
{
"device_id":10999,
"id":2035914,
"originalPrice":"782.99",
"originalCurrency":"USD",
"shortHash":"https:\/\/www.kimovil.com\/to\/PSNG1S",
"hash":"PSNG1S",
"provider":{
"id":343,
"provider_group_id":229,
"countryDeliveryTo":{
"countryCode":"XX"
},
"destinationCountries":[
"XX"
],
"country_sale_restriction":[
"RU",
"BR",
"MX"
],
"warehouse_country_code":"CN"
},
"eurPrice":"770.13",
"gbpPrice":"643.73",
"usdPrice":"782.99",
"rubPrice":"47554.12",
"inrPrice":"61530.42",
"plnPrice":"3636.26",
"brlPrice":"4132.47",
"mxnPrice":"16267.67"
},
{
"device_id":10999,
"id":2527843,
"originalPrice":"815.00",
"originalCurrency":"EUR",
"shortHash":"https:\/\/www.kimovil.com\/to\/4C1JF3",
"hash":"4C1JF3",
"provider":{
"id":846,
"provider_group_id":206,
"countryDeliveryTo":{
"countryCode":"DE"
},
"destinationCountries":[
"DE"
],
"country_sale_restriction":[
],
"warehouse_country_code":"GB"
},
"eurPrice":"815.00",
"gbpPrice":"681.23",
"usdPrice":"828.61",
"rubPrice":"50324.83",
"inrPrice":"65115.46",
"plnPrice":"3848.12",
"brlPrice":"4373.24",
"mxnPrice":"17215.50"
},
{
"device_id":10999,
"id":2527875,
"originalPrice":"815.00",
"originalCurrency":"EUR",
"shortHash":"https:\/\/www.kimovil.com\/to\/MR65RB",
"hash":"MR65RB",
"provider":{
"id":844,
"provider_group_id":206,
"countryDeliveryTo":{
"countryCode":"ES"
},
"destinationCountries":[
"ES"
],
"country_sale_restriction":[
],
"warehouse_country_code":"GB"
},
"eurPrice":"815.00",
"gbpPrice":"681.23",
"usdPrice":"828.61",
"rubPrice":"50324.83",
"inrPrice":"65115.46",
"plnPrice":"3848.12",
"brlPrice":"4373.24",
"mxnPrice":"17215.50"
},
{
"device_id":10999,
"id":2527951,
"originalPrice":"815.00",
"originalCurrency":"EUR",
"shortHash":"https:\/\/www.kimovil.com\/to\/S8GBMT",
"hash":"S8GBMT",
"provider":{
"id":847,
"provider_group_id":206,
"countryDeliveryTo":{
"countryCode":"FR"
},
"destinationCountries":[
"FR"
],
"country_sale_restriction":[
],
"warehouse_country_code":"GB"
},
"eurPrice":"815.00",
"gbpPrice":"681.23",
"usdPrice":"828.61",
"rubPrice":"50324.83",
"inrPrice":"65115.46",
"plnPrice":"3848.12",
"brlPrice":"4373.24",
"mxnPrice":"17215.50"
},
{
"device_id":10999,
"id":2528034,
"originalPrice":"815.00",
"originalCurrency":"EUR",
"shortHash":"https:\/\/www.kimovil.com\/to\/H261CY",
"hash":"H261CY",
"provider":{
"id":843,
"provider_group_id":206,
"countryDeliveryTo":{
"countryCode":"GR"
},
"destinationCountries":[
"GR"
],
"country_sale_restriction":[
],
"warehouse_country_code":"GB"
},
"eurPrice":"815.00",
"gbpPrice":"681.23",
"usdPrice":"828.61",
"rubPrice":"50324.83",
"inrPrice":"65115.46",
"plnPrice":"3848.12",
"brlPrice":"4373.24",
"mxnPrice":"17215.50"
},
{
"device_id":10999,
"id":2528111,
"originalPrice":"815.00",
"originalCurrency":"EUR",
"shortHash":"https:\/\/www.kimovil.com\/to\/M294BB",
"hash":"M294BB",
"provider":{
"id":1096,
"provider_group_id":206,
"countryDeliveryTo":{
"countryCode":"IT"
},
"destinationCountries":[
"IT"
],
"country_sale_restriction":[
],
"warehouse_country_code":"GB"
},
"eurPrice":"815.00",
"gbpPrice":"681.23",
"usdPrice":"828.61",
"rubPrice":"50324.83",
"inrPrice":"65115.46",
"plnPrice":"3848.12",
"brlPrice":"4373.24",
"mxnPrice":"17215.50"
},
{
"device_id":10999,
"id":2528217,
"originalPrice":"684.78",
"originalCurrency":"GBP",
"shortHash":"https:\/\/www.kimovil.com\/to\/WSBL8Z",
"hash":"WSBL8Z",
"provider":{
"id":845,
"provider_group_id":206,
"countryDeliveryTo":{
"countryCode":"GB"
},
"destinationCountries":[
"GB"
],
"country_sale_restriction":[
],
"warehouse_country_code":"GB"
},
"eurPrice":"819.24",
"gbpPrice":"684.78",
"usdPrice":"832.92",
"rubPrice":"50586.78",
"inrPrice":"65454.40",
"plnPrice":"3868.15",
"brlPrice":"4396.00",
"mxnPrice":"17305.11"
}
],
"deals":[
],
"active_campaign":{
"id":5,
"slug":"dailydeals",
"campaign_translations":{
"en":{
"url":"https:\/\/www.kimovil.com\/en\/special\/dailydeals",
"image":"\/\/d2giyh01gjb6fi.cloudfront.net\/images\/special_campaign\/daily_deals\/mini_image_en.jpg"
},
"es":{
"url":"https:\/\/www.kimovil.com\/es\/special\/dailydeals",
"image":"\/\/d2giyh01gjb6fi.cloudfront.net\/images\/special_campaign\/daily_deals\/mini-image_es.jpg"
},
"ru":{
"url":"https:\/\/www.kimovil.com\/ru\/special\/dailydeals",
"image":"\/\/d2giyh01gjb6fi.cloudfront.net\/images\/special_campaign\/daily_deals\/mini_image_en.jpg"
},
"de":{
"url":"https:\/\/www.kimovil.com\/de\/special\/dailydeals",
"image":"\/\/d2giyh01gjb6fi.cloudfront.net\/images\/special_campaign\/daily_deals\/mini_image_en.jpg"
},
"fr":{
"url":"https:\/\/www.kimovil.com\/fr\/special\/dailydeals",
"image":"\/\/d2giyh01gjb6fi.cloudfront.net\/images\/special_campaign\/daily_deals\/mini_image_en.jpg"
},
"it":{
"url":"https:\/\/www.kimovil.com\/it\/special\/dailydeals",
"image":"\/\/d2giyh01gjb6fi.cloudfront.net\/images\/special_campaign\/daily_deals\/mini_image_en.jpg"
},
"el":{
"url":"https:\/\/www.kimovil.com\/el\/special\/dailydeals",
"image":"\/\/d2giyh01gjb6fi.cloudfront.net\/images\/special_campaign\/daily_deals\/mini_image_en.jpg"
},
"pt":{
"url":"https:\/\/www.kimovil.com\/pt\/special\/dailydeals",
"image":"\/\/d2giyh01gjb6fi.cloudfront.net\/images\/special_campaign\/daily_deals\/mini_image_en.jpg"
},
"pl":{
"url":"https:\/\/www.kimovil.com\/pl\/special\/dailydeals",
"image":"\/\/d2giyh01gjb6fi.cloudfront.net\/images\/special_campaign\/daily_deals\/mini_image_en.jpg"
}
}
},
"timestamp":"1659515690",
"datetime":"Wed, 03 Aug 2022 10:34:50 +0200"
}
Related
I have a JSON file with not valid structure. The error occures on the line 181 (propery "edu_data"). In VS code the description of problen is "expecting comma (json 514)". In the online JSON validator the error message is "Expecting comma or ], not colon".
I've checked the JSON manully a lot of times but can't figure out where I'd missed the symbol. So please help me to find the missing symbol.
{
"response":"success",
"description":"Ok",
"objects":[
{
"type":"hr_application",
"object":{
"appl_id":98,
"type":"hr",
"state":200,
"user_state":200,
"business_dept":"pyat",
"loader_user_name":"X5\\M.Sergeev",
"loader_comment":"",
"load_time":"2019-09-25T14:35:38.91",
"user_name":"x5\\Anna.Ivanina",
"system_comment":"Иванов Иван Сергеевич",
"pi_data":[
{
"pi_id":11111,
"pi_relation":"main",
"state":"other",
"fio_data":[
{
"is_actual":true,
"f":"Иванов",
"i":"Иван",
"o":"Сергеевич",
"norm_f":"иванов",
"norm_i":"иван",
"norm_o":"сергеевич"
}
],
"d":6,
"m":10,
"y":1978,
"citizenship":"",
"gender":"",
"b_place":"г. Обнинск",
"inn":"123456789012",
"is_enterp":false,
"is_enterp_comment":"",
"aff_with_x5":false,
"driver_data":{
"license_info":"",
"car_info":""
},
"id_document_data":[
{
"is_actual":true,
"type":"pasp",
"series":"1234",
"number":"123123",
"issuer":"УВД города Обнинска",
"issue_date":"07.03.2011",
"norm_series":"1234",
"norm_number":"123123",
"is_valid":1
}
],
"adr_data":[
{
"type":"reg",
"value":"г Обнинск, ул Ленина, д 2, кв 1",
"norm_value":" г Обнинск, ул Ленина, д 2, кв 1"
},
{
"type":"reg_tmp",
"value":"",
"norm_value":""
},
{
"type":"liv",
"value":" г Обнинск, ул Набережная, д 7, кв 1",
"norm_value":" г Обнинск, ул Набережная, д 7, кв 1"
}
],
"tel_data":[
{
"type":"mob",
"value":"79111111111",
"norm_value":"9111111111"
}
],
"email_data":[
{
"type":"pers",
"value":"IvanObninsk#gmail.com",
"norm_value":"ivanobninsk#gmail.com"
}
],
"le_data":[
{
"pi_relation":"employee",
"state":"other",
"name":"ООО Компания в которой работал кандидат",
"full_name":"",
"legal_form":"",
"inn":"",
"ogrn":"",
"kpp":"",
"okpo":"",
"okonh":"",
"reg_date":"",
"reg_place":"",
"okved_data":[
{
"value":"Услуги"
}
],
"tel_data":[
{
"type":"mob",
"value":"",
"norm_value":""
}
],
"email_data":[
],
"adr_data":[
{
"type":"leg",
"value":"г Москва пр. Коммунистический 34",
"norm_value":" г Москва пр. Коммунистический 34"
}
],
"pi_position":"инженер",
"pi_respons":"",
"pi_start_date":"01.2012",
"pi_end_date":"05.2016",
"pi_man_info":"",
"pi_quit_reas":"смена работы",
"pi_ach_info":"",
"pi_is_last":true
},
{
"pi_relation":"employee",
"state":"other",
"name":"ООО Компания 23",
"full_name":"",
"legal_form":"",
"inn":"",
"ogrn":"",
"kpp":"",
"okpo":"",
"okonh":"",
"reg_date":"",
"reg_place":"",
"okved_data":[
{
"value":"торговля"
}
],
"tel_data":[
{
"type":"mob",
"value":"",
"norm_value":""
}
],
"email_data":[
],
"adr_data":[
{
"type":"leg",
"value":"",
"norm_value":""
}
],
"pi_position":"риэлтор",
"pi_respons":"",
"pi_start_date":"07.2016",
"pi_end_date":"07.2019",
"pi_man_info":"",
"pi_quit_reas":"маленькая зп",
"pi_ach_info":"",
"pi_is_last":false
},
"edu_data":[
{
"type":"main",
"name":"Институт г Обнинск ",
"speciality":"Менеджер",
"start_year":"2006",
"end_year":"2011"
}
],
"prosp_dept":"Перекресток Офис",
"prosp_position":"менеджер по аренде",
"prosp_comment":"",
"prosp_vac_inf_src":"",
"res_data":[
{
"id":123456,
"hr_appl_id":123123,
"pi_id":11111,
"res_user_name":"X5\\Anna.Ivanina ",
"res":-1,
"comment":"Комментарии аналитика 1",
"inner_comment":"Внутренний комментарий 1",
"create_time":"2019-09-26T10:44:26.353",
"res_code_data":[
""
],
"res_text_data":[
]
},
{
"id":123458,
"hr_appl_id":123123,
"pi_id":11111,
"res_user_name":"X5\\Ivanov ",
"res":-1,
"comment":"Комментарии аналитика 2",
"inner_comment":"Внутренний комментарий 2",
"create_time":"2019-09-27T11:04:26.353",
"res_code_data":[
],
"res_text_data":[
]
}
],
"appr_data":[
{
"id":98766,
"hr_appl_id":123123,
"pi_id":11111,
"init_user_name":"X5\\Igor.Sergeev",
"dest_email":"Am.Soglasuushaya#x5.ru",
"dest_comment":"",
"email_message_id":0,
"res":1,
"comment":" ",
"create_time":"2019-09-26T10:15:35.833",
"update_time":"2019-09-26T12:50:40.567",
"url":"65565GGHJUGFHF8FJF8EOE0RURKF8EL",
"security_manager_appr_data":[
{
"id":1234,
"hr_appl_id":123123,
"pi_id":11111,
"pi_appr_id":98766,
"security_manager_user_namee":"x5\\Alek.Fedrenko",
"security_manager_res":1,
"create_time":"2019-09-26T10:15:35.883",
"update_time":"2019-09-26T10:21:59.293"
}
]
},
{
"id":98564,
"hr_appl_id":123123,
"pi_id":11111,
"init_user_name":"X5\\Vlad.Petrov ",
"dest_email":"M.Disapprovov#x5.ru",
"dest_comment":"",
"email_message_id":0,
"res":0,
"comment":" ",
"create_time":"2019-09-26T10:15:04.567",
"update_time":"2019-09-26T10:15:04.567",
"url":"DHDHDHD5D6DHD7D7DD7D7D9DKD9DDLSDKF9F9994F",
"security_manager_appr_data":[
{
"id":123451,
"hr_appl_id":123123,
"pi_id":11111,
"pi_appr_id":98564,
"security_manager_user_namee":"x5\\Petr.Andreev ",
"security_manager_res":0,
"create_time":"2019-03-11T10:15:04.583",
"update_time":"2019-03-11T10:15:04.583"
}
]
}
],
"chk_stage":"checked_pos",
"appr_allowed":false,
"res_allowed":true,
"email_message_data":[
],
"aux_info":""
},
{
"pi_id":11111,
"pi_relation":"mother",
"state":"other",
"fio_data":[
{
"is_actual":true,
"f":"Иванова",
"i":"Галина",
"o":"Петровна",
"norm_f":"лыкова",
"norm_i":"галина",
"norm_o":"сергеевна"
}
],
"d":30,
"m":11,
"y":1958,
"citizenship":"",
"gender":"",
"b_place":"",
"inn":"",
"is_enterp":false,
"is_enterp_comment":"",
"aff_with_x5":false,
"driver_data":{
"license_info":"",
"car_info":""
},
"id_document_data":[
],
"adr_data":[
{
"type":"liv",
"value":"",
"norm_value":""
}
],
"tel_data":[
],
"email_data":[
],
"le_data":[
{
"pi_relation":"employee",
"state":"other",
"name":"Пенсионер",
"full_name":"",
"legal_form":"",
"inn":"",
"ogrn":"",
"kpp":"",
"okpo":"",
"okonh":"",
"reg_date":"",
"reg_place":"",
"okved_data":[
],
"tel_data":[
],
"email_data":[
],
"adr_data":[
],
"pi_position":"",
"pi_respons":"",
"pi_start_date":"",
"pi_end_date":"",
"pi_man_info":"",
"pi_quit_reas":"",
"pi_ach_info":"",
"pi_is_last":false
}
],
"edu_data":[
],
"prosp_dept":"",
"prosp_position":"",
"prosp_comment":"",
"prosp_vac_inf_src":"",
"res_data":[
],
"appr_data":[
],
"chk_stage":"ready",
"appr_allowed":false,
"res_allowed":false,
"email_message_data":[
],
"aux_info":""
},
"file_data":[
],
"is_manual":false,
"is_postponed":false
}
}
]
}
Here is your Valid JSON, it was the array symbol creating the issue. Array closing was missing before edu_data key.
{
"response": "success",
"description": "Ok",
"objects": [{
"type": "hr_application",
"object": {
"appl_id": 98,
"type": "hr",
"state": 200,
"user_state": 200,
"business_dept": "pyat",
"loader_user_name": "X5\\M.Sergeev",
"loader_comment": "",
"load_time": "2019-09-25T14:35:38.91",
"user_name": "x5\\Anna.Ivanina",
"system_comment": "Иванов Иван Сергеевич",
"pi_data": [{
"pi_id": 11111,
"pi_relation": "main",
"state": "other",
"fio_data": [{
"is_actual": true,
"f": "Иванов",
"i": "Иван",
"o": "Сергеевич",
"norm_f": "иванов",
"norm_i": "иван",
"norm_o": "сергеевич"
}],
"d": 6,
"m": 10,
"y": 1978,
"citizenship": "",
"gender": "",
"b_place": "г. Обнинск",
"inn": "123456789012",
"is_enterp": false,
"is_enterp_comment": "",
"aff_with_x5": false,
"driver_data": {
"license_info": "",
"car_info": ""
},
"id_document_data": [{
"is_actual": true,
"type": "pasp",
"series": "1234",
"number": "123123",
"issuer": "УВД города Обнинска",
"issue_date": "07.03.2011",
"norm_series": "1234",
"norm_number": "123123",
"is_valid": 1
}],
"adr_data": [{
"type": "reg",
"value": "г Обнинск, ул Ленина, д 2, кв 1",
"norm_value": " г Обнинск, ул Ленина, д 2, кв 1"
},
{
"type": "reg_tmp",
"value": "",
"norm_value": ""
},
{
"type": "liv",
"value": " г Обнинск, ул Набережная, д 7, кв 1",
"norm_value": " г Обнинск, ул Набережная, д 7, кв 1"
}
],
"tel_data": [{
"type": "mob",
"value": "79111111111",
"norm_value": "9111111111"
}],
"email_data": [{
"type": "pers",
"value": "IvanObninsk#gmail.com",
"norm_value": "ivanobninsk#gmail.com"
}],
"le_data": [{
"pi_relation": "employee",
"state": "other",
"name": "ООО Компания в которой работал кандидат",
"full_name": "",
"legal_form": "",
"inn": "",
"ogrn": "",
"kpp": "",
"okpo": "",
"okonh": "",
"reg_date": "",
"reg_place": "",
"okved_data": [{
"value": "Услуги"
}],
"tel_data": [{
"type": "mob",
"value": "",
"norm_value": ""
}],
"email_data": [
],
"adr_data": [{
"type": "leg",
"value": "г Москва пр. Коммунистический 34",
"norm_value": " г Москва пр. Коммунистический 34"
}],
"pi_position": "инженер",
"pi_respons": "",
"pi_start_date": "01.2012",
"pi_end_date": "05.2016",
"pi_man_info": "",
"pi_quit_reas": "смена работы",
"pi_ach_info": "",
"pi_is_last": true
},
{
"pi_relation": "employee",
"state": "other",
"name": "ООО Компания 23",
"full_name": "",
"legal_form": "",
"inn": "",
"ogrn": "",
"kpp": "",
"okpo": "",
"okonh": "",
"reg_date": "",
"reg_place": "",
"okved_data": [{
"value": "торговля"
}],
"tel_data": [{
"type": "mob",
"value": "",
"norm_value": ""
}],
"email_data": [
],
"adr_data": [{
"type": "leg",
"value": "",
"norm_value": ""
}],
"pi_position": "риэлтор",
"pi_respons": "",
"pi_start_date": "07.2016",
"pi_end_date": "07.2019",
"pi_man_info": "",
"pi_quit_reas": "маленькая зп",
"pi_ach_info": "",
"pi_is_last": false
}
],
"edu_data": [{
"type": "main",
"name": "Институт г Обнинск ",
"speciality": "Менеджер",
"start_year": "2006",
"end_year": "2011"
}],
"prosp_dept": "Перекресток Офис",
"prosp_position": "менеджер по аренде",
"prosp_comment": "",
"prosp_vac_inf_src": "",
"res_data": [{
"id": 123456,
"hr_appl_id": 123123,
"pi_id": 11111,
"res_user_name": "X5\\Anna.Ivanina ",
"res": -1,
"comment": "Комментарии аналитика 1",
"inner_comment": "Внутренний комментарий 1",
"create_time": "2019-09-26T10:44:26.353",
"res_code_data": [
""
],
"res_text_data": [
]
},
{
"id": 123458,
"hr_appl_id": 123123,
"pi_id": 11111,
"res_user_name": "X5\\Ivanov ",
"res": -1,
"comment": "Комментарии аналитика 2",
"inner_comment": "Внутренний комментарий 2",
"create_time": "2019-09-27T11:04:26.353",
"res_code_data": [
],
"res_text_data": [
]
}
],
"appr_data": [{
"id": 98766,
"hr_appl_id": 123123,
"pi_id": 11111,
"init_user_name": "X5\\Igor.Sergeev",
"dest_email": "Am.Soglasuushaya#x5.ru",
"dest_comment": "",
"email_message_id": 0,
"res": 1,
"comment": " ",
"create_time": "2019-09-26T10:15:35.833",
"update_time": "2019-09-26T12:50:40.567",
"url": "65565GGHJUGFHF8FJF8EOE0RURKF8EL",
"security_manager_appr_data": [{
"id": 1234,
"hr_appl_id": 123123,
"pi_id": 11111,
"pi_appr_id": 98766,
"security_manager_user_namee": "x5\\Alek.Fedrenko",
"security_manager_res": 1,
"create_time": "2019-09-26T10:15:35.883",
"update_time": "2019-09-26T10:21:59.293"
}]
},
{
"id": 98564,
"hr_appl_id": 123123,
"pi_id": 11111,
"init_user_name": "X5\\Vlad.Petrov ",
"dest_email": "M.Disapprovov#x5.ru",
"dest_comment": "",
"email_message_id": 0,
"res": 0,
"comment": " ",
"create_time": "2019-09-26T10:15:04.567",
"update_time": "2019-09-26T10:15:04.567",
"url": "DHDHDHD5D6DHD7D7DD7D7D9DKD9DDLSDKF9F9994F",
"security_manager_appr_data": [{
"id": 123451,
"hr_appl_id": 123123,
"pi_id": 11111,
"pi_appr_id": 98564,
"security_manager_user_namee": "x5\\Petr.Andreev ",
"security_manager_res": 0,
"create_time": "2019-03-11T10:15:04.583",
"update_time": "2019-03-11T10:15:04.583"
}]
}
],
"chk_stage": "checked_pos",
"appr_allowed": false,
"res_allowed": true,
"email_message_data": [
],
"aux_info": ""
},
{
"pi_id": 11111,
"pi_relation": "mother",
"state": "other",
"fio_data": [{
"is_actual": true,
"f": "Иванова",
"i": "Галина",
"o": "Петровна",
"norm_f": "лыкова",
"norm_i": "галина",
"norm_o": "сергеевна"
}],
"d": 30,
"m": 11,
"y": 1958,
"citizenship": "",
"gender": "",
"b_place": "",
"inn": "",
"is_enterp": false,
"is_enterp_comment": "",
"aff_with_x5": false,
"driver_data": {
"license_info": "",
"car_info": ""
},
"id_document_data": [
],
"adr_data": [{
"type": "liv",
"value": "",
"norm_value": ""
}],
"tel_data": [
],
"email_data": [
],
"le_data": [{
"pi_relation": "employee",
"state": "other",
"name": "Пенсионер",
"full_name": "",
"legal_form": "",
"inn": "",
"ogrn": "",
"kpp": "",
"okpo": "",
"okonh": "",
"reg_date": "",
"reg_place": "",
"okved_data": [
],
"tel_data": [
],
"email_data": [
],
"adr_data": [
],
"pi_position": "",
"pi_respons": "",
"pi_start_date": "",
"pi_end_date": "",
"pi_man_info": "",
"pi_quit_reas": "",
"pi_ach_info": "",
"pi_is_last": false
}],
"edu_data": [
],
"prosp_dept": "",
"prosp_position": "",
"prosp_comment": "",
"prosp_vac_inf_src": "",
"res_data": [
],
"appr_data": [
],
"chk_stage": "ready",
"appr_allowed": false,
"res_allowed": false,
"email_message_data": [
],
"aux_info": ""
}
],
"file_data": [
],
"is_manual": false,
"is_postponed": false
}
}]
}
Here maps provides an API to search for places in the map. If the threshold is not provided, by default, it returns a json with 20 results. However in the json the url to next page of the result is also provided. But with all that I am unable to get more than 100 results in total.
https://places.cit.api.here.com/places/v1/discover/search?app_id=/////myAppId/////&app_code=/////myAppCode/////&q=rewe&in=52.521,13.3807;r=624715.0
q = the search keyword
in = the geo coordinates
r = radius of the area
Result of the call:
{
"results": {
"next": "https://places.cit.api.here.com/places/v1/discover/search;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmb2Zmc2V0PTEwJnNpemU9MTA?in=52.521%2C13.3807%3Br%3D624715.0&q=rewe&app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"items": [{
"position": [
52.52045,
13.38844
],
"distance": 527,
"title": "REWE City",
"averageRating": 0.0,
"category": {
"id": "food-drink",
"title": "Food & Drink",
"href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"type": "urn:nlp-types:category",
"system": "places"
},
"icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
"vicinity": "Friedrichstraße 100<br/>Mitte, 10117 Berlin",
"having": [],
"type": "urn:nlp-types:place",
"href": "https://places.cit.api.here.com/places/v1/places/276u33db-478f50cd5ded4446a1a0c82616ffdedf;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz0w?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"id": "276u33db-478f50cd5ded4446a1a0c82616ffdedf",
"openingHours": {
"text": "Mon-Sat: 07:00 - 23:30",
"label": "Opening hours",
"isOpen": true,
"structured": [{
"start": "T070000",
"duration": "PT16H30M",
"recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR,SA"
}]
},
"chainIds": [
"1192"
]
},
{
"position": [
52.52568,
13.36847
],
"distance": 977,
"title": "Rewe",
"averageRating": 0.0,
"category": {
"id": "food-drink",
"title": "Food & Drink",
"href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"type": "urn:nlp-types:category",
"system": "places"
},
"icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
"vicinity": "Europaplatz 1<br/>Moabit, 10557 Berlin",
"having": [],
"type": "urn:nlp-types:place",
"href": "https://places.cit.api.here.com/places/v1/places/276u33db-cea8ce21a43348229139e7ce91e9dcbc;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz0x?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"id": "276u33db-cea8ce21a43348229139e7ce91e9dcbc",
"chainIds": [
"1192"
]
},
{
"position": [
52.52961,
13.38399
],
"distance": 983,
"title": "REWE",
"averageRating": 0.0,
"category": {
"id": "food-drink",
"title": "Food & Drink",
"href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"type": "urn:nlp-types:category",
"system": "places"
},
"icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
"vicinity": "Chausseestraße 118<br/>Mitte, 10115 Berlin",
"having": [],
"type": "urn:nlp-types:place",
"href": "https://places.cit.api.here.com/places/v1/places/276u33db-1f765b467b8d49a992b787580ee4a583;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz0y?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"id": "276u33db-1f765b467b8d49a992b787580ee4a583",
"openingHours": {
"text": "Mon-Sat: 08:00 - 23:00",
"label": "Opening hours",
"isOpen": true,
"structured": [{
"start": "T080000",
"duration": "PT15H00M",
"recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR,SA"
}]
},
"chainIds": [
"1192"
]
},
{
"position": [
52.51238,
13.39002
],
"distance": 1147,
"title": "REWE",
"averageRating": 0.0,
"category": {
"id": "food-drink",
"title": "Food & Drink",
"href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"type": "urn:nlp-types:category",
"system": "places"
},
"icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
"vicinity": "Friedrichstraße 67<br/>Mitte, 10117 Berlin",
"having": [],
"type": "urn:nlp-types:place",
"href": "https://places.cit.api.here.com/places/v1/places/276jx7ps-56fd3ec94cad047f686ce22f4ce9e99d;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz0z?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"id": "276jx7ps-56fd3ec94cad047f686ce22f4ce9e99d",
"openingHours": {
"text": "Mon-Sat: 08:00 - 22:00",
"label": "Opening hours",
"isOpen": true,
"structured": [{
"start": "T080000",
"duration": "PT14H00M",
"recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR,SA"
}]
},
"chainIds": [
"1192"
]
},
{
"position": [
52.50813,
13.37448
],
"distance": 1492,
"title": "REWE",
"averageRating": 0.0,
"category": {
"id": "food-drink",
"title": "Food & Drink",
"href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"type": "urn:nlp-types:category",
"system": "places"
},
"icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
"vicinity": "Alte Potsdamer Straße 7<br/>Tiergarten, 10785 Berlin",
"having": [],
"type": "urn:nlp-types:place",
"href": "https://places.cit.api.here.com/places/v1/places/276jx7ps-dfc2afc7bbd60188a0bc0d07cd441c55;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz00?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"id": "276jx7ps-dfc2afc7bbd60188a0bc0d07cd441c55",
"openingHours": {
"text": "Mon-Sat: 09:00 - 21:00",
"label": "Opening hours",
"isOpen": true,
"structured": [{
"start": "T090000",
"duration": "PT12H00M",
"recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR,SA"
}]
},
"chainIds": [
"1192"
]
},
{
"position": [
52.53245,
13.39711
],
"distance": 1689,
"title": "REWE",
"averageRating": 0.0,
"category": {
"id": "food-drink",
"title": "Food & Drink",
"href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"type": "urn:nlp-types:category",
"system": "places"
},
"icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
"vicinity": "Invalidenstraße 158<br/>Mitte, 10115 Berlin",
"having": [],
"type": "urn:nlp-types:place",
"href": "https://places.cit.api.here.com/places/v1/places/276u33db-771494bd265e4c97be3e8b2eacb213d1;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz01?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"id": "276u33db-771494bd265e4c97be3e8b2eacb213d1",
"openingHours": {
"text": "Mon-Sat: 08:00 - 23:00",
"label": "Opening hours",
"isOpen": true,
"structured": [{
"start": "T080000",
"duration": "PT15H00M",
"recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR,SA"
}]
},
"chainIds": [
"1192"
]
},
{
"position": [
52.53051,
13.4115
],
"distance": 2337,
"title": "REWE",
"averageRating": 0.0,
"category": {
"id": "food-drink",
"title": "Food & Drink",
"href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"type": "urn:nlp-types:category",
"system": "places"
},
"icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
"vicinity": "Schönhauser Allee 10<br/>10119 Berlin",
"having": [],
"type": "urn:nlp-types:place",
"href": "https://places.cit.api.here.com/places/v1/places/276u33dc-f8d6288526a142d598ad69d3187da0f2;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz02?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"id": "276u33dc-f8d6288526a142d598ad69d3187da0f2",
"openingHours": {
"text": "Mon-Sat: 08:00 - 23:30",
"label": "Opening hours",
"isOpen": true,
"structured": [{
"start": "T080000",
"duration": "PT15H30M",
"recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR,SA"
}]
},
"chainIds": [
"1192"
]
},
{
"position": [
52.51866,
13.34227
],
"distance": 2613,
"title": "REWE City",
"averageRating": 0.0,
"category": {
"id": "food-drink",
"title": "Food & Drink",
"href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"type": "urn:nlp-types:category",
"system": "places"
},
"icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
"vicinity": "Bartningallee 3<br/>Hansaviertel, 10557 Berlin",
"having": [],
"type": "urn:nlp-types:place",
"href": "https://places.cit.api.here.com/places/v1/places/276u336z-9ca5d8c0940348739e8b6f36ae55f973;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz03?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"id": "276u336z-9ca5d8c0940348739e8b6f36ae55f973",
"openingHours": {
"text": "Mon-Sat: 07:00 - 22:00",
"label": "Opening hours",
"isOpen": true,
"structured": [{
"start": "T070000",
"duration": "PT15H00M",
"recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR,SA"
}]
},
"chainIds": [
"1192"
]
},
{
"position": [
52.49923,
13.36233
],
"distance": 2721,
"title": "REWE City",
"averageRating": 0.0,
"category": {
"id": "food-drink",
"title": "Food & Drink",
"href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"type": "urn:nlp-types:category",
"system": "places"
},
"icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
"vicinity": "Potsdamer Straße 128<br/>Schöneberg, 10783 Berlin",
"having": [],
"type": "urn:nlp-types:place",
"href": "https://places.cit.api.here.com/places/v1/places/276jx7ps-80fed37e7219054ce1c53ab104610624;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz04?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"id": "276jx7ps-80fed37e7219054ce1c53ab104610624",
"openingHours": {
"text": "Mon-Sat: 07:00 - 22:00",
"label": "Opening hours",
"isOpen": true,
"structured": [{
"start": "T070000",
"duration": "PT15H00M",
"recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR,SA"
}]
},
"chainIds": [
"1192"
]
},
{
"position": [
52.53819,
13.41262
],
"distance": 2884,
"title": "REWE",
"averageRating": 0.0,
"category": {
"id": "food-drink",
"title": "Food & Drink",
"href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"type": "urn:nlp-types:category",
"system": "places"
},
"icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
"vicinity": "Schönhauser Allee 36<br/>Prenzlauer Berg, 10435 Berlin",
"having": [],
"type": "urn:nlp-types:place",
"href": "https://places.cit.api.here.com/places/v1/places/276u33dc-cb9574c5960146b9b30559acf4daf639;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz05?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"id": "276u33dc-cb9574c5960146b9b30559acf4daf639",
"openingHours": {
"text": "Mon-Fri: 08:00 - 00:00<br/>Sat: 08:00 - 23:00",
"label": "Opening hours",
"isOpen": true,
"structured": [{
"start": "T080000",
"duration": "PT16H00M",
"recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR"
},
{
"start": "T080000",
"duration": "PT15H00M",
"recurrence": "FREQ:DAILY;BYDAY:SA"
}
]
},
"chainIds": [
"1192"
]
}
]
},
"search": {
"context": {
"location": {
"position": [
52.521,
13.3807
],
"address": {
"text": "Luisenstraße 35<br/>Mitte, 10117 Berlin<br/>Germany",
"house": "35",
"street": "Luisenstraße",
"postalCode": "10117",
"district": "Mitte",
"city": "Berlin",
"county": "Berlin",
"stateCode": "Berlin",
"country": "Germany",
"countryCode": "DEU"
}
},
"type": "urn:nlp-types:place",
"href": "https://places.cit.api.here.com/places/v1/places/loc-dmVyc2lvbj0xO3RpdGxlPUx1aXNlbnN0cmElQzMlOUZlKzM1O2xhdD01Mi41MjE7bG9uPTEzLjM4MDc7c3RyZWV0PUx1aXNlbnN0cmElQzMlOUZlO2hvdXNlPTM1O2NpdHk9QmVybGluO3Bvc3RhbENvZGU9MTAxMTc7Y291bnRyeT1ERVU7ZGlzdHJpY3Q9TWl0dGU7c3RhdGVDb2RlPUJlcmxpbjtjb3VudHk9QmVybGluO2NhdGVnb3J5SWQ9YnVpbGRpbmc7c291cmNlU3lzdGVtPWludGVybmFs;context=c2VhcmNoQ29udGV4dD0x?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A"
},
"ranking": "chain"
}
}
I am trying to extract all the franchises of a certain store in the whole area (which is ~3000) but somehow i am not able to get more than 100 results.
Any Solutions to that?
Places API is designed with an end user customer perspective and provides only a limited number of results for a given category. Still for any given category you will be able to get 100 results(maximum). you have to set the size parameter as size=100 to get the maximum(100) result at a time.
http://places.demo.api.here.com/places/v1/discover/around?at=52.521%2C13.3807&cat=hotel&size=100&Accept-Language=en-US%2Cen%3Bq%3D0.5&app_id=&app_code=
I am looking for some to extract the value from a nested json when the condition is matching
Here you can see three different items are listed. I wanted to exact item value
when the "target-name": "$variable"
For example if "target-name": "dev-cn-c2" then the item value will be "item": "Standard"
I tried json_query
results.results[?target-name==dev-cn-c2].item
and I am getting below response
[
"PolicyPKG1",
"PolicyPKG2",
"Standard"
]
Please see the full json
{
"results": {
"changed": false,
"msg": "All items completed",
"results": [
{
"ansible_facts": {
"checkpoint_access_layers": {
"access": true,
"access-layers": [
{
"domain": {
"domain-type": "global domain",
"name": "Global",
"uid": "1e294ce0-367a-11e3-aa6e-0800200c9a66"
},
"name": "Network",
"type": "access-layer",
"uid": "b94c472e-56df-42f7-9c28-2b0b3d470657"
},
{
"domain": {
"domain-type": "domain",
"name": "dom-cn-1",
"uid": "9597dde5-6c2e-4696-a4b9-0e9c5118947a"
},
"name": "PolicyPKG1 Network",
"type": "access-layer",
"uid": "96ab580d-939a-476f-ac25-48782a1a4ed9"
}
],
"color": "black",
"comments": "",
"desktop-security": false,
"domain": {
"domain-type": "domain",
"name": "dom-cn-1",
"uid": "9597dde5-6c2e-4696-a4b9-0e9c5118947a"
},
"icon": "Blades/Access",
"installation-targets": "all",
"meta-info": {
"creation-time": {
"iso-8601": "2019-07-30T15:38+0530",
"posix": 1564481316745
},
"creator": "admin",
"last-modifier": "admin",
"last-modify-time": {
"iso-8601": "2019-07-30T15:38+0530",
"posix": 1564481316745
},
"lock": "unlocked",
"validation-state": "ok"
},
"name": "PolicyPKG1",
"nat-policy": true,
"qos": false,
"qos-policy-type": "recommended",
"read-only": false,
"tags": [],
"threat-prevention": false,
"type": "package",
"uid": "231616b2-5ffa-4afe-9dcb-8fe1d0dd9ae3",
"vpn-traditional-mode": false
}
},
"ansible_loop_var": "item",
"changed": false,
"failed": false,
"invocation": {
"module_args": {
"name": "PolicyPKG1",
"uid": null
}
},
"item": "PolicyPKG1"
},
{
"ansible_facts": {
"checkpoint_access_layers": {
"access": true,
"access-layers": [
{
"domain": {
"domain-type": "global domain",
"name": "Global",
"uid": "1e294ce0-367a-11e3-aa6e-0800200c9a66"
},
"name": "Network",
"type": "access-layer",
"uid": "b94c472e-56df-42f7-9c28-2b0b3d470657"
},
{
"domain": {
"domain-type": "domain",
"name": "dom-cn-1",
"uid": "9597dde5-6c2e-4696-a4b9-0e9c5118947a"
},
"name": "PolicyPKG2 Network",
"type": "access-layer",
"uid": "9651831a-7e9e-4a60-848f-ca4e194e2393"
}
],
"color": "black",
"comments": "",
"desktop-security": false,
"domain": {
"domain-type": "domain",
"name": "dom-cn-1",
"uid": "9597dde5-6c2e-4696-a4b9-0e9c5118947a"
},
"icon": "Blades/Access",
"installation-targets": "all",
"meta-info": {
"creation-time": {
"iso-8601": "2019-07-30T15:38+0530",
"posix": 1564481331344
},
"creator": "admin",
"last-modifier": "admin",
"last-modify-time": {
"iso-8601": "2019-07-30T15:38+0530",
"posix": 1564481331344
},
"lock": "unlocked",
"validation-state": "ok"
},
"name": "PolicyPKG2",
"nat-policy": true,
"qos": false,
"qos-policy-type": "recommended",
"read-only": false,
"tags": [],
"threat-prevention": false,
"type": "package",
"uid": "d579c212-5486-4242-aa63-b510f6f3c93c",
"vpn-traditional-mode": false
},
"discovered_interpreter_python": "/usr/bin/python"
},
"ansible_loop_var": "item",
"changed": false,
"failed": false,
"invocation": {
"module_args": {
"name": "PolicyPKG2",
"uid": null
}
},
"item": "PolicyPKG2"
},
{
"ansible_facts": {
"checkpoint_access_layers": {
"access": true,
"access-layers": [
{
"domain": {
"domain-type": "global domain",
"name": "Global",
"uid": "1e294ce0-367a-11e3-aa6e-0800200c9a66"
},
"name": "Network",
"type": "access-layer",
"uid": "b94c472e-56df-42f7-9c28-2b0b3d470657"
},
{
"domain": {
"domain-type": "domain",
"name": "dom-cn-1",
"uid": "9597dde5-6c2e-4696-a4b9-0e9c5118947a"
},
"name": "security",
"type": "access-layer",
"uid": "82d38fdf-11a1-4d2d-bc11-380aa922af1a"
},
{
"domain": {
"domain-type": "domain",
"name": "dom-cn-1",
"uid": "9597dde5-6c2e-4696-a4b9-0e9c5118947a"
},
"name": "Network",
"type": "access-layer",
"uid": "809bb6ce-2dbb-4e28-8bec-a6365999cdb5"
}
],
"color": "black",
"comments": "",
"desktop-security": false,
"domain": {
"domain-type": "domain",
"name": "dom-cn-1",
"uid": "9597dde5-6c2e-4696-a4b9-0e9c5118947a"
},
"icon": "Blades/Access",
"installation-targets": "all",
"installation-targets-revision": [
{
"cluster-members-revision": [
{
"revision": {
"domain": {
"domain-type": "domain",
"name": "dom-cn-1",
"uid": "9597dde5-6c2e-4696-a4b9-0e9c5118947a"
},
"name": "admin#4/30/2019",
"type": "session",
"uid": "1240db79-9cfa-4a29-b7f9-2b82fd915f4d"
},
"target-name": "dev-cn-c1",
"target-uid": "84ed0d02-4a01-4079-90c2-b4a119e64cf2"
},
{
"revision": {
"domain": {
"domain-type": "domain",
"name": "dom-cn-1",
"uid": "9597dde5-6c2e-4696-a4b9-0e9c5118947a"
},
"name": "admin#4/30/2019",
"type": "session",
"uid": "1240db79-9cfa-4a29-b7f9-2b82fd915f4d"
},
"target-name": "dev-cn-c2",
"target-uid": "2639ab93-01ab-472c-a071-b24ad62eb49c"
}
],
"target-name": "Clus-01",
"target-uid": "7a5f9f5c-b533-4db6-b808-e8088ce6ab3c"
},
{
"cluster-members-revision": [
{
"revision": {
"domain": {
"domain-type": "domain",
"name": "dom-cn-1",
"uid": "9597dde5-6c2e-4696-a4b9-0e9c5118947a"
},
"name": "admin#4/30/2019",
"type": "session",
"uid": "58b232f3-7826-40a7-b7f0-0e35985e999a"
},
"target-name": "dev-cn-4",
"target-uid": "36289a7f-57ff-4320-bfe4-e7c640f3fdb1"
},
{
"revision": {
"domain": {
"domain-type": "domain",
"name": "dom-cn-1",
"uid": "9597dde5-6c2e-4696-a4b9-0e9c5118947a"
},
"name": "admin#4/30/2019",
"type": "session",
"uid": "58b232f3-7826-40a7-b7f0-0e35985e999a"
},
"target-name": "dev-cn-c3",
"target-uid": "443a3649-65fe-4a7e-bf48-66973f239bf6"
}
],
"target-name": "Clus-cn-02",
"target-uid": "5a395d40-0615-4cde-9a39-5c024fc0278d"
}
],
"meta-info": {
"creation-time": {
"iso-8601": "2019-04-26T16:31+0530",
"posix": 1556276469175
},
"creator": "System",
"last-modifier": "System",
"last-modify-time": {
"iso-8601": "2019-04-26T16:31+0530",
"posix": 1556276469175
},
"lock": "unlocked",
"validation-state": "ok"
},
"name": "Standard",
"nat-policy": true,
"qos": false,
"qos-policy-type": "recommended",
"read-only": false,
"tags": [],
"threat-layers": [
{
"domain": {
"domain-type": "domain",
"name": "dom-cn-1",
"uid": "9597dde5-6c2e-4696-a4b9-0e9c5118947a"
},
"name": "IPS",
"type": "threat-layer",
"uid": "5cab7f13-b376-4866-9b2d-1920ffc9a222"
},
{
"domain": {
"domain-type": "domain",
"name": "dom-cn-1",
"uid": "9597dde5-6c2e-4696-a4b9-0e9c5118947a"
},
"name": "Standard Threat Prevention",
"type": "threat-layer",
"uid": "bcaa152e-f1d6-4c9e-aeee-4a5046abb061"
}
],
"threat-prevention": true,
"type": "package",
"uid": "dc4d894f-8c77-41fc-bfd8-3a1a3c1335e2",
"vpn-traditional-mode": false
}
},
"ansible_loop_var": "item",
"changed": false,
"failed": false,
"invocation": {
"module_args": {
"name": "Standard",
"uid": null
}
},
"item": "Standard"
}
]
}
}
Try this:
- debug:
var: results | json_query(query)
vars:
query: results[?ansible_facts.checkpoint_access_layers."installation-targets-revision"[?"cluster-members-revision"[?"target-name"=='dev-cn-c2']]].item
The query has been split out into a separate variable because string escaping in json_query is hard, and the hyphens (-) in the keys (for example target-name) messes things up a little.
I am trying to search for flights between two places in Sabre using BargainFindermax API. The API provides me with a list of all flights. However, there is no direct relation to which of the flights are linked.
For example, I searched for flights between BLR > LCY. The response I got included flights for AMS > LCY, BLR > DEL, BLR > DEL, DEL > AMS, AMS > LCY.
From this, I can construct the following route BLR > DEL > AMS > LCY. But there are two flights for BLR > DEL and AMS > LCY.
How can I identify which of these flights are related?
Here is the complete JSON response,
{
"groupedItineraryResponse": {
"version": "5.2.0",
"messages": [
{
"severity": "Info",
"type": "WORKERTHREAD",
"code": "TRANSACTIONID",
"text": "2074398531853061390"
},
{
"severity": "Info",
"type": "SERVER",
"code": "ASE032LPSCIL9UM.IDM.SGDCCERT.SABRE.COM",
"text": "27036"
},
{
"severity": "Info",
"type": "DRE",
"code": "RULEID",
"text": "17203"
},
{
"severity": "Info",
"type": "DEFAULT",
"code": "RULEID",
"text": "25238"
}
],
"statistics": {
"itineraryCount": 2
},
"scheduleDescs": [
{
"id": 1,
"frequency": "*MTWTFS",
"stopCount": 0,
"eTicketable": true,
"totalMilesFlown": 257,
"departure": {
"airport": "AMS",
"city": "AMS",
"country": "NL",
"time": "08:45:00+02:00"
},
"arrival": {
"airport": "LCY",
"city": "LON",
"country": "GB",
"time": "08:50:00+01:00"
},
"carrier": {
"marketing": "KL",
"marketingFlightNumber": 985,
"operating": "KL",
"operatingFlightNumber": 985,
"codeShared": "/KLM CITYHOPPER",
"equipment": {
"code": "E90",
"typeForFirstLeg": "N",
"typeForLastLeg": "N"
}
}
},
{
"id": 2,
"trafficRestriction": "G",
"frequency": "SMTWTFS",
"stopCount": 0,
"eTicketable": true,
"totalMilesFlown": 1058,
"departure": {
"airport": "BLR",
"city": "BLR",
"country": "IN",
"time": "19:50:00+05:30"
},
"arrival": {
"airport": "DEL",
"city": "DEL",
"country": "IN",
"time": "22:50:00+05:30",
"terminal": "3"
},
"carrier": {
"marketing": "KL",
"marketingFlightNumber": 3798,
"operating": "9W",
"operatingFlightNumber": 812,
"disclosure": "9W",
"equipment": {
"code": "73H",
"typeForFirstLeg": "N",
"typeForLastLeg": "N"
}
}
},
{
"id": 3,
"trafficRestriction": "G",
"frequency": "SMTWTFS",
"stopCount": 0,
"eTicketable": true,
"totalMilesFlown": 1058,
"departure": {
"airport": "BLR",
"city": "BLR",
"country": "IN",
"time": "18:55:00+05:30"
},
"arrival": {
"airport": "DEL",
"city": "DEL",
"country": "IN",
"time": "22:00:00+05:30",
"terminal": "3"
},
"carrier": {
"marketing": "KL",
"marketingFlightNumber": 3703,
"operating": "9W",
"operatingFlightNumber": 833,
"disclosure": "9W",
"equipment": {
"code": "738",
"typeForFirstLeg": "N",
"typeForLastLeg": "N"
}
}
},
{
"id": 4,
"frequency": "*M**T**",
"stopCount": 0,
"eTicketable": true,
"totalMilesFlown": 3961,
"departure": {
"airport": "DEL",
"city": "DEL",
"country": "IN",
"time": "02:10:00+05:30",
"terminal": "3"
},
"arrival": {
"airport": "AMS",
"city": "AMS",
"country": "NL",
"time": "07:40:00+02:00"
},
"carrier": {
"marketing": "KL",
"marketingFlightNumber": 3817,
"operating": "9W",
"operatingFlightNumber": 234,
"disclosure": "9W",
"equipment": {
"code": "333",
"typeForFirstLeg": "W",
"typeForLastLeg": "W"
}
}
},
{
"id": 5,
"frequency": "*MTWTFS",
"stopCount": 0,
"eTicketable": true,
"totalMilesFlown": 257,
"departure": {
"airport": "AMS",
"city": "AMS",
"country": "NL",
"time": "09:25:00+02:00"
},
"arrival": {
"airport": "LCY",
"city": "LON",
"country": "GB",
"time": "09:30:00+01:00"
},
"carrier": {
"marketing": "KL",
"marketingFlightNumber": 987,
"operating": "KL",
"operatingFlightNumber": 987,
"codeShared": "/KLM CITYHOPPER",
"equipment": {
"code": "E90",
"typeForFirstLeg": "N",
"typeForLastLeg": "N"
}
}
}
],
"taxDescs": [
{
"id": 1,
"code": "YRI",
"amount": 160,
"currency": "USD",
"description": "SERVICE FEE - CARRIER-IMPOSED MISC",
"publishedAmount": 160,
"publishedCurrency": "USD",
"station": "DEL"
},
{
"id": 2,
"code": "YQI",
"amount": 13.3,
"currency": "USD",
"description": "SERVICE FEE - INSURANCE",
"publishedAmount": 925,
"publishedCurrency": "INR",
"station": "BLR"
},
{
"id": 3,
"code": "WO",
"amount": 3.8,
"currency": "USD",
"description": "PASSENGER SERVICE FEE",
"publishedAmount": 3.8,
"publishedCurrency": "USD",
"station": "BLR",
"country": "IN"
},
{
"id": 4,
"code": "K38",
"amount": 11.5,
"currency": "USD",
"description": "GOODS AND SERVICE TAX INTERIM DOMESTIC AND INTERNATIONAL",
"publishedAmount": 799,
"publishedCurrency": "INR",
"station": "BLR",
"country": "IN"
},
{
"id": 5,
"code": "CJ",
"amount": 7.4,
"currency": "USD",
"description": "SECURITY SERVICE CHARGE",
"publishedAmount": 6.5,
"publishedCurrency": "EUR",
"station": "AMS",
"country": "NL"
},
{
"id": 6,
"code": "RN",
"amount": 7.3,
"currency": "USD",
"description": "PASSENGER SERVICE CHARGE",
"publishedAmount": 6.4,
"publishedCurrency": "EUR",
"station": "AMS",
"country": "NL"
},
{
"id": 7,
"code": "IN",
"amount": 5.2,
"currency": "USD",
"description": "USER DEVELOPMENT FEE DEPARTURES",
"publishedAmount": 362,
"publishedCurrency": "INR",
"station": "BLR",
"country": "IN"
}
],
"taxSummaryDescs": [
{
"id": 1,
"code": "YRI",
"amount": 160,
"currency": "USD",
"description": "SERVICE FEE - CARRIER-IMPOSED MISC",
"publishedAmount": 160,
"publishedCurrency": "USD",
"station": "DEL"
},
{
"id": 2,
"code": "YQI",
"amount": 13.3,
"currency": "USD",
"description": "SERVICE FEE - INSURANCE",
"publishedAmount": 925,
"publishedCurrency": "INR",
"station": "BLR"
},
{
"id": 3,
"code": "WO",
"amount": 3.8,
"currency": "USD",
"description": "PASSENGER SERVICE FEE",
"publishedAmount": 3.8,
"publishedCurrency": "USD",
"station": "BLR",
"country": "IN"
},
{
"id": 4,
"code": "K38",
"amount": 11.5,
"currency": "USD",
"description": "GOODS AND SERVICE TAX INTERIM DOMESTIC AND INTERNATIONAL",
"publishedAmount": 0.05,
"publishedCurrency": "INR",
"station": "BLR",
"country": "IN"
},
{
"id": 5,
"code": "CJ",
"amount": 7.4,
"currency": "USD",
"description": "SECURITY SERVICE CHARGE",
"publishedAmount": 6.5,
"publishedCurrency": "EUR",
"station": "AMS",
"country": "NL"
},
{
"id": 6,
"code": "RN",
"amount": 7.3,
"currency": "USD",
"description": "PASSENGER SERVICE CHARGE",
"publishedAmount": 6.4,
"publishedCurrency": "EUR",
"station": "AMS",
"country": "NL"
},
{
"id": 7,
"code": "IN",
"amount": 5.2,
"currency": "USD",
"description": "USER DEVELOPMENT FEE DEPARTURES",
"publishedAmount": 362,
"publishedCurrency": "INR",
"station": "BLR",
"country": "IN"
}
],
"fareComponentDescs": [
{
"id": 1,
"governingCarrier": "KL",
"fareAmount": 24.65,
"fareCurrency": "INR",
"fareBasisCode": "XPLWIA",
"farePassengerType": "ADT",
"publishedFareAmount": 1717,
"oneWayFare": true,
"directionality": "FROM",
"direction": "EH",
"notValidBefore": "2019-07-21",
"notValidAfter": "2019-07-21",
"applicablePricingCategories": "4 5 6 7 8 10 12 16 18",
"vendorCode": "ATP",
"fareTypeBitmap": "00",
"fareType": "PRU",
"fareTariff": "4",
"fareRule": "INPL",
"segments": [
{
"segment": {
"surcharges": [
{
"amount": 28.71,
"currency": "NUC",
"description": "MISCELLANEOUS/OTHER",
"type": "Q"
}
]
}
},
{
"segment": {}
},
{
"segment": {}
}
]
}
],
"validatingCarrierDescs": [
{
"id": 1,
"settlementMethod": "ARC",
"newVcxProcess": true,
"default": {
"code": "DL"
}
}
],
"baggageAllowanceDescs": [
{
"id": 1,
"pieceCount": 1
}
],
"legDescs": [
{
"id": 1,
"schedules": [
{
"ref": 2
},
{
"ref": 4,
"departureDateAdjustment": 1
},
{
"ref": 5,
"departureDateAdjustment": 1
}
]
},
{
"id": 2,
"schedules": [
{
"ref": 3
},
{
"ref": 4,
"departureDateAdjustment": 1
},
{
"ref": 1,
"departureDateAdjustment": 1
}
]
}
],
"itineraryGroups": [
{
"groupDescription": {
"legDescriptions": [
{
"departureDate": "2019-07-21",
"departureLocation": "BLR",
"arrivalLocation": "LCY"
}
]
},
"itineraries": [
{
"id": 1,
"pricingSource": "ADVJR1",
"legs": [
{
"ref": 2
}
],
"pricingInformation": [
{
"pricingSubsource": "MIP",
"fare": {
"validatingCarrierCode": "DL",
"vita": true,
"eTicketable": true,
"lastTicketDate": "2019-07-05",
"governingCarriers": "KL",
"passengerInfoList": [
{
"passengerInfo": {
"passengerType": "ADT",
"passengerNumber": 1,
"nonRefundable": true,
"fareComponents": [
{
"ref": 1,
"segments": [
{
"segment": {
"bookingCode": "X",
"cabinCode": "Y",
"mealCode": "D",
"seatsAvailable": 9
}
},
{
"segment": {
"bookingCode": "X",
"cabinCode": "Y",
"mealCode": "RB",
"seatsAvailable": 9
}
},
{
"segment": {
"bookingCode": "L",
"cabinCode": "Y",
"mealCode": "M",
"seatsAvailable": 9,
"availabilityBreak": true
}
}
]
}
],
"taxes": [
{
"ref": 2
},
{
"ref": 1
},
{
"ref": 7
},
{
"ref": 4
},
{
"ref": 3
},
{
"ref": 5
},
{
"ref": 6
}
],
"taxSummaries": [
{
"ref": 2
},
{
"ref": 1
},
{
"ref": 3
},
{
"ref": 4
},
{
"ref": 7
},
{
"ref": 5
},
{
"ref": 6
}
],
"currencyConversion": {
"from": "INR",
"to": "USD",
"exchangeRateUsed": 0.01442679
},
"fareMessages": [
{
"type": "N",
"code": "0",
"carrier": "KL",
"info": "FARE RESTRICTIONS APPLY/CARRIER RESTRICTIONS APPLY"
},
{
"type": "W",
"code": "0",
"info": "VALIDATING CARRIER - DL PER GSA AGREEMENT WITH KL"
}
],
"passengerTotalFare": {
"totalFare": 264.5,
"totalTaxAmount": 208.5,
"currency": "USD",
"baseFareAmount": 3875,
"baseFareCurrency": "INR",
"equivalentAmount": 56,
"equivalentCurrency": "USD",
"constructionAmount": 55.59,
"constructionCurrency": "NUC",
"commissionPercentage": 0,
"commissionAmount": 0,
"exchangeRateOne": 69.651352
},
"baggageInformation": [
{
"provisionType": "A",
"airlineCode": "KL",
"segments": [
{
"id": 0
},
{
"id": 1
},
{
"id": 2
}
],
"allowance": {
"ref": 1
}
}
]
}
}
],
"totalFare": {
"totalPrice": 264.5,
"totalTaxAmount": 208.5,
"currency": "USD",
"baseFareAmount": 3875,
"baseFareCurrency": "INR",
"constructionAmount": 55.59,
"constructionCurrency": "NUC",
"equivalentAmount": 56,
"equivalentCurrency": "USD"
},
"validatingCarriers": [
{
"ref": 1
}
]
}
}
],
"diversitySwapper": {
"weighedPrice": 409.855
}
},
{
"id": 2,
"pricingSource": "ADVJR1",
"legs": [
{
"ref": 1
}
],
"pricingInformation": [
{
"pricingSubsource": "MIP",
"fare": {
"validatingCarrierCode": "DL",
"vita": true,
"eTicketable": true,
"lastTicketDate": "2019-07-05",
"governingCarriers": "KL",
"passengerInfoList": [
{
"passengerInfo": {
"passengerType": "ADT",
"passengerNumber": 1,
"nonRefundable": true,
"fareComponents": [
{
"ref": 1,
"segments": [
{
"segment": {
"bookingCode": "X",
"cabinCode": "Y",
"mealCode": "D",
"seatsAvailable": 9
}
},
{
"segment": {
"bookingCode": "X",
"cabinCode": "Y",
"mealCode": "RB",
"seatsAvailable": 9
}
},
{
"segment": {
"bookingCode": "L",
"cabinCode": "Y",
"mealCode": "M",
"seatsAvailable": 9,
"availabilityBreak": true
}
}
]
}
],
"taxes": [
{
"ref": 2
},
{
"ref": 1
},
{
"ref": 7
},
{
"ref": 4
},
{
"ref": 3
},
{
"ref": 5
},
{
"ref": 6
}
],
"taxSummaries": [
{
"ref": 2
},
{
"ref": 1
},
{
"ref": 3
},
{
"ref": 4
},
{
"ref": 7
},
{
"ref": 5
},
{
"ref": 6
}
],
"currencyConversion": {
"from": "INR",
"to": "USD",
"exchangeRateUsed": 0.01442679
},
"fareMessages": [
{
"type": "N",
"code": "0",
"carrier": "KL",
"info": "FARE RESTRICTIONS APPLY/CARRIER RESTRICTIONS APPLY"
},
{
"type": "W",
"code": "0",
"info": "VALIDATING CARRIER - DL PER GSA AGREEMENT WITH KL"
}
],
"passengerTotalFare": {
"totalFare": 264.5,
"totalTaxAmount": 208.5,
"currency": "USD",
"baseFareAmount": 3875,
"baseFareCurrency": "INR",
"equivalentAmount": 56,
"equivalentCurrency": "USD",
"constructionAmount": 55.59,
"constructionCurrency": "NUC",
"commissionPercentage": 0,
"commissionAmount": 0,
"exchangeRateOne": 69.651352
},
"baggageInformation": [
{
"provisionType": "A",
"airlineCode": "KL",
"segments": [
{
"id": 0
},
{
"id": 1
},
{
"id": 2
}
],
"allowance": {
"ref": 1
}
}
]
}
}
],
"totalFare": {
"totalPrice": 264.5,
"totalTaxAmount": 208.5,
"currency": "USD",
"baseFareAmount": 3875,
"baseFareCurrency": "INR",
"constructionAmount": 55.59,
"constructionCurrency": "NUC",
"equivalentAmount": 56,
"equivalentCurrency": "USD"
},
"validatingCarriers": [
{
"ref": 1
}
]
}
}
],
"diversitySwapper": {
"weighedPrice": 367.631
}
}
]
}
]
}
}
You have to use legDescs list to connect your segments, and use those "ref" values.
For example:
{
"id": 2,
"schedules": [
{
"ref": 3
},
{
"departureDateAdjustment": 1,
"ref": 4
},
{
"departureDateAdjustment": 1,
"ref": 1
}
]
}
means, your flight with ID = 2 contains 3 segments, with id 3 - 4 and 1. When you search numbered segments in "scheduleDescs" object, you can see routes are:
BLR - DEL
DEL - AMS
AMS - LCY
and as you can see you got the BLR - LCY flight.
I'm getting json error in my first reactjs work. It is very important for me and work which I am a candidate. How can I fix this? Thank u very much.
related class:
constructor() {
super();
this.state = {
data:[],
}
}
componentDidMount(){
fetch('../JsonFiles/routes.json').
then(response => response.json()).
then(findresponse => this.setState ({ data: findresponse.data }));
}
render() {
return (
<div>
fasfasfa
{
this.state.data.map((dynamicData, key) =>
<div>
<span> {dynamicData.routes.origin.cityName} </span>
<span> {dynamicData.routes.destinations[{}].cityName} </span>
</div>
)
}
</div>
);
}
}
json file:
{"routes": [
{
"origin": {
"name": "Aalborg Airport",
"country": "DK",
"cityName": "Aalborg",
"cityCode": "AAL"
},
"destinations": [
{
"name": "Bornholm Rønne",
"country": "DK",
"cityName": "Bornholm",
"cityCode": "RNN"
}
]
},
{
"origin": {
"name": "Barca",
"country": "ES",
"cityName": "Barcelona",
"cityCode": "BCN"
},
"destinations": [
{
"name": "Borispol",
"country": "UA",
"cityName": "Kyiv",
"cityCode": "KBP"
}
]
},
{
"origin": {
"name": "Billund",
"country": "DK",
"cityName": "Billund",
"cityCode": "BLL"
},
"destinations": [
{
"name": "Bornholm Rønne",
"country": "DK",
"cityName": "Bornholm",
"cityCode": "RNN"
},
{
"name": "København Kastrup",
"country": "DK",
"cityName": "Copenhagen",
"cityCode": "CPH"
},
{
"name": "Stavanger Sola",
"country": "NO",
"cityName": "Stavanger",
"cityCode": "SVG"
}
]
},
{
"origin": {
"name": "Bornholm Rønne",
"country": "DK",
"cityName": "Bornholm",
"cityCode": "RNN"
},
"destinations": [
{
"name": "Aalborg Airport",
"country": "DK",
"cityName": "Aalborg",
"cityCode": "AAL"
},
{
"name": "Billund",
"country": "DK",
"cityName": "Billund",
"cityCode": "BLL"
},
{
"name": "København Kastrup",
"country": "DK",
"cityName": "Copenhagen",
"cityCode": "CPH"
},
{
"name": "Midtjyllands Lufthavn (Karup)",
"country": "DK",
"cityName": "Midtjyllands Lufthavn (Karup)",
"cityCode": "KRP"
},
{
"name": "Stavanger Sola",
"country": "NO",
"cityName": "Stavanger",
"cityCode": "SVG"
}
]
},
{
"origin": {
"name": "Charles de Gaulle",
"country": "FR",
"cityName": "Charles de Gaulle",
"cityCode": "CDG"
},
"destinations": [
{
"name": "Billund",
"country": "DK",
"cityName": "Billund",
"cityCode": "BLL"
}
]
},
{
"origin": {
"name": "København Kastrup",
"country": "DK",
"cityName": "Copenhagen",
"cityCode": "CPH"
},
"destinations": [
{
"name": "Billund",
"country": "DK",
"cityName": "Billund",
"cityCode": "BLL"
},
{
"name": "Bornholm Rønne",
"country": "DK",
"cityName": "Bornholm",
"cityCode": "RNN"
},
{
"name": "Midtjyllands Lufthavn (Karup)",
"country": "DK",
"cityName": "Midtjyllands Lufthavn (Karup)",
"cityCode": "KRP"
}
]
},
{
"origin": {
"name": "Esbjerg",
"country": "DK",
"cityName": "Esbjerg",
"cityCode": "EBJ"
},
"destinations": [
{
"name": "Stavanger Sola",
"country": "NO",
"cityName": "Stavanger",
"cityCode": "SVG"
}
]
},
{
"origin": {
"name": "Borispol",
"country": "UA",
"cityName": "Kyiv",
"cityCode": "KBP"
},
"destinations": [
{
"name": "Barca",
"country": "ES",
"cityName": "Barcelona",
"cityCode": "BCN"
}
]
},
{
"origin": {
"name": "Midtjyllands Lufthavn (Karup)",
"country": "DK",
"cityName": "Midtjyllands Lufthavn (Karup)",
"cityCode": "KRP"
},
"destinations": [
{
"name": "Bornholm Rønne",
"country": "DK",
"cityName": "Bornholm",
"cityCode": "RNN"
},
{
"name": "København Kastrup",
"country": "DK",
"cityName": "Copenhagen",
"cityCode": "CPH"
}
]
},
{
"origin": {
"name": "Oslo Gardermoen",
"country": "NO",
"cityName": "Oslo",
"cityCode": "OSL"
},
"destinations": [
{
"name": "Stord lufthavn, Sørstokken",
"country": "NO",
"cityName": "Stord",
"cityCode": "SRP"
},
{
"name": "Ørland",
"country": "NO",
"cityName": "Ørland",
"cityCode": "OLA"
}
]
},
{
"origin": {
"name": "Rhodos",
"country": "GR",
"cityName": "Rhodos",
"cityCode": "RHO"
},
"destinations": [
{
"name": "Billund",
"country": "DK",
"cityName": "Billund",
"cityCode": "BLL"
}
]
},
{
"origin": {
"name": "Stavanger Sola",
"country": "NO",
"cityName": "Stavanger",
"cityCode": "SVG"
},
"destinations": [
{
"name": "Billund",
"country": "DK",
"cityName": "Billund",
"cityCode": "BLL"
},
{
"name": "Bornholm Rønne",
"country": "DK",
"cityName": "Bornholm",
"cityCode": "RNN"
},
{
"name": "Esbjerg",
"country": "DK",
"cityName": "Esbjerg",
"cityCode": "EBJ"
}
]
},
{
"origin": {
"name": "Stord lufthavn, Sørstokken",
"country": "NO",
"cityName": "Stord",
"cityCode": "SRP"
},
"destinations": [
{
"name": "Oslo Gardermoen",
"country": "NO",
"cityName": "Oslo",
"cityCode": "OSL"
}
]
},
{
"origin": {
"name": "Ørland",
"country": "NO",
"cityName": "Ørland",
"cityCode": "OLA"
},
"destinations": [
{
"name": "Oslo Gardermoen",
"country": "NO",
"cityName": "Oslo",
"cityCode": "OSL"
}
]
}
]}
AND I AM GETTING THIS ERROR:
I AM GETTING THIS ERROR
1
Unhandled Rejection (SyntaxError): Unexpected token < in JSON at position 0
(anonymous function)
D:/development/js-projects/material-tutorial/src/Components/TrialForm/FlightSearch.js:13
10 |
11 | componentDidMount(){
12 | fetch('../JsonFiles/routes.json').
13 | then(response => response.json()).
14 | then(findresponse => this.setState ({ data: findresponse.data }));
15 |
16 |
You can import JSON file.
import * as jsonFile from '../JsonFiles/routes.json';
Define it on state in constructor function:
constructor() {
super();
this.state = {
data: jsonFile
}
}
es2015 version:
import jsonFile from '../JsonFiles/routes.json';
Now you have all json data available in "jsonFile" and you can use it any where.