I have a json data in a separate file (airport.json) as below
airport.json
{"DEL":{"id":"31973","airport_name":"Indira Gandhi","latitude":"28.5632","longitude":"77.1183","timezone":"5.5","dst_indicator":"N","city":"New Delhi","country":"India","country_code":"IN","region":"TC1","listing_display":"true","pseudonyms":"New Delhi,Delhi"}, "CCU":{"id":"31965","airport_name":"Netaji Subhas Chandra Bose","latitude":"22.6453","longitude":"88.4401","timezone":"5.5","dst_indicator":"N","city":"Kolkata","country":"India","country_code":"IN","region":"TC1","listing_display":"true","pseudonyms":"Kolkota,Calcutta"}}
In html file i have written code to initialize autocomplete
$(".city").autocomplete("js/airports.json",{
remoteDataType:'json',
minChars: 3,
max: 8,
autoFill: false,
mustMatch: true,
matchContains: true,
scrollHeight: 220
});
TEXTBOX
But is returning list as a srting like below:
{"DEL":{"id":"31973","airport_name":"Indira Gandhi","latitude":"28.5632","longitude":"77.1183","timezone":"5.5","dst_indicator":"N","city":"New Delhi","country":"India","country_code":"IN","region":"TC1","listing_display":"true","pseudonyms":"New Delhi,Delhi"}, "CCU":{"id":"31965","airport_name":"Netaji Subhas Chandra Bose","latitude":"22.6453","longitude":"88.4401","timezone":"5.5","dst_indicator":"N","city":"Kolkata","country":"India","country_code":"IN","region":"TC1","listing_display":"true","pseudonyms":"Kolkota,Calcutta"}}
and getting a error "not well formed".
My data should be in below format only for display(city, country_code - airport_name (city-code)) but to match it should take pseudonyms as well :-
List should be like
New Delhi, IN - Indira Gandhi (DEL)
Kolkata, IN - Netaji Subhas Chandra Bose (CCU)