Json to HTML conversion

Hi There,

I am a kind of stuck with this json code please help to convert it into html

the code is:

{"Response__Depart":{"OriginDestinationOptions":{"OriginDestinationOption":[{"FareDetails":{"ChargeableFares":{"ActualBaseFare":"4900","Tax":"4695","STax":"31","SCharge":"0","TDiscount":"0","TPartnerCommission":"0","YDiscount":0},"NonchargeableFares":{"TCharge":"0","TMarkup":"0","TSdiscount":"0"}},"FlightSegments":{"FlightSegment":{"AirEquipType":"321","ArrivalAirportCode":"GOI","ArrivalDateTime":"2015-02-17T14:05:00","DepartureAirportCode":"DEL","DepartureDateTime":"2015-02-17T10:00:00","FlightNumber":"865","OperatingAirlineCode":"AI","OperatingAirlineFlightNumber":"865","RPH":"","StopQuantity":"1","airLineName":"Air India","airportTax":"4695","imageFileName":"http:\/\/letitgo.asia\/air\/logos\/AI.gif","viaFlight":"Via Flight","BookingClass":{"Availability":"4","ResBookDesigCode":"U"},"BookingClassFare":{"adultFare":"4900","bookingclass":"U","classType":"Economy","farebasiscode":"fjyS3YyUlEusLfJ4bwgPvQ==","Rule":"This fare is Refundable
Baggage : 25K
Booking Class : U|Re-Schedule Charges: Rs. 750 per sector + Fare difference (If any) +admin fee 500 + Service Fee of Rs. 250 \nSector .|Cancellation Charges : Basic fare +Airline administration fee 500 + Service Charges 250 Per Passenger Per Sector .\n\t\t\t\t\t |","adultCommission":"0","childCommission":"0","commissionOnTCharge":"0"},"Discount":"0","airportTaxChild":"0","airportTaxInfant":"0","adultTaxBreakup":"3500,147,1048","childTaxBreakup":"0,0,0","infantTaxBreakup":"0,0,0","octax":"0"}},"id":"SID11","key":"wtZcSVMY\/gphWFSOTFWg8tk50VHVm+kKmz72bOU0EddnhBOSGC88VScTJzH+TWN+u\/enLT1a3Q2W\nO8yH8+0tzhcz4QY3xkHBPzbifHG6uDdDwLtSiN0xXv7t275sUnc7dCU\/tDATA83xTgfh9d8ZSmFY\nVI5MVaDy4aTAWelliZQnEycx\/k1jfv+QxLuqYmdiJxMnMf5NY36YIq2FtLkfcHtsd+IDEhxpxJuT\nv4YyS+QnEycx\/k1jftlsnmWWqYGnJxMnMf5NY37ZbJ5llqmBpycTJzH+TWN+VP4IkHv5hF13\/CPY\nEOpqGs2hLlYrFkYJXnTfRGc5sz+rHbrYNZjlj2FYVI5MVaDyFiThuG7WKPhzqWDbQb1E1IqUKT5I\nFtF6OaCYjb6EFGhDwLtSiN0xXuGKZvzqVEPzv18OFlhFoI+A\/uAfnTovYr9fDhZYRaCPgP7gH506\nL2K\/Xw4WWEWgj4D+4B+dOi9iv18OFlhFoI+A\/uAfnTovYr9fDhZYRaCPgP7gH506L2K\/Xw4WWEWg\nj4D+4B+dOi9iv18OFlhFoI\/TtX74xvGuAcDVnDglq4nHQ\/zni8QE42g8S0GV1z3SJXaOdoTFisn9\nv18OFlhFoI+ThOYsjNAbXEP854vEBONoPEtBldc90iVD\/OeLxATjaAwTg0ygCEBm3Xgf4+0FXWxD\n\/OeLxATjaDxLQZXXPdIlQ\/zni8QE42jXGTnbB\/ydvYH+S5Ji2d7cYVhUjkxVoPJtRWbi6bZrXL9f\nDhZYRaCPgP7gH506L2K\/Xw4WWEWgj4D+4B+dOi9iv18OFlhFoI8KriAmVoEyR3OpYNtBvUTUp1Mf\nI240+obPusGaAOeuxg=="}]}}}

Thanks in advance

Have you tried something like this?

Store it into the variable, for example:

var myJSON = '{"AirEquipType":"321","ArrivalAirportCode":"GOI"}';

Then parse it into the object:

var result = JSON.parse(myJSON);

After that you can access fields:

alert(result.ArrivalAirportCode); // GOI

Then it’s up to you where to put each field in your DOM. I would use jQuery for that, because all process become easier .

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.