- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要从在线API解析Json对象的帮助。
我是新手,但我不太了解如何解决这个问题,而且似乎没有很多在线资源。
JSON如下所示:
{ "data": [ { "type": "flight-destination", "origin": "MAD", "destination": "LON", "departureDate": "2020-03-11", "returnDate": "2020-03-14", "price": { "total": "80.55" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=LON&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=LON&departureDate=2020-03-11&returnDate=2020-03-14&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "ALC", "departureDate": "2020-03-23", "returnDate": "2020-03-28", "price": { "total": "87.29" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=ALC&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=ALC&departureDate=2020-03-23&returnDate=2020-03-28&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "GOA", "departureDate": "2020-02-27", "returnDate": "2020-03-12", "price": { "total": "99.96" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=GOA&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=GOA&departureDate=2020-02-27&returnDate=2020-03-12&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "MUC", "departureDate": "2020-03-23", "returnDate": "2020-03-29", "price": { "total": "120.58" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=MUC&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=MUC&departureDate=2020-03-23&returnDate=2020-03-29&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "VCE", "departureDate": "2020-04-14", "returnDate": "2020-04-28", "price": { "total": "125.92" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=VCE&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=VCE&departureDate=2020-04-14&returnDate=2020-04-28&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "GOT", "departureDate": "2020-03-15", "returnDate": "2020-03-19", "price": { "total": "134.99" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=GOT&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=GOT&departureDate=2020-03-15&returnDate=2020-03-19&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "VIE", "departureDate": "2020-02-29", "returnDate": "2020-03-01", "price": { "total": "135.72" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=VIE&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=VIE&departureDate=2020-02-29&returnDate=2020-03-01&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "TUN", "departureDate": "2020-04-09", "returnDate": "2020-04-13", "price": { "total": "139.01" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=TUN&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=TUN&departureDate=2020-04-09&returnDate=2020-04-13&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "KRK", "departureDate": "2020-05-11", "returnDate": "2020-05-13", "price": { "total": "142.34" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=KRK&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=KRK&departureDate=2020-05-11&returnDate=2020-05-13&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "WAW", "departureDate": "2020-03-11", "returnDate": "2020-03-15", "price": { "total": "143.66" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=WAW&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=WAW&departureDate=2020-03-11&returnDate=2020-03-15&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "PSA", "departureDate": "2020-03-04", "returnDate": "2020-03-07", "price": { "total": "145.61" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=PSA&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=PSA&departureDate=2020-03-04&returnDate=2020-03-07&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "DBV", "departureDate": "2020-03-23", "returnDate": "2020-03-26", "price": { "total": "156.53" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=DBV&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=DBV&departureDate=2020-03-23&returnDate=2020-03-26&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "GLA", "departureDate": "2020-03-25", "returnDate": "2020-04-07", "price": { "total": "163.70" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=GLA&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=GLA&departureDate=2020-03-25&returnDate=2020-04-07&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "LWO", "departureDate": "2020-04-14", "returnDate": "2020-04-17", "price": { "total": "164.20" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=LWO&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=LWO&departureDate=2020-04-14&returnDate=2020-04-17&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "MOW", "departureDate": "2020-03-31", "returnDate": "2020-04-05", "price": { "total": "172.70" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=MOW&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=MOW&departureDate=2020-03-31&returnDate=2020-04-05&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "TLL", "departureDate": "2020-03-06", "returnDate": "2020-03-13", "price": { "total": "177.03" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=TLL&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=TLL&departureDate=2020-03-06&returnDate=2020-03-13&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "REK", "departureDate": "2020-03-23", "returnDate": "2020-03-27", "price": { "total": "184.74" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=REK&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=REK&departureDate=2020-03-23&returnDate=2020-03-27&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "RIX", "departureDate": "2020-03-06", "returnDate": "2020-03-13", "price": { "total": "197.33" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=RIX&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=RIX&departureDate=2020-03-06&returnDate=2020-03-13&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "CLJ", "departureDate": "2020-03-24", "returnDate": "2020-03-28", "price": { "total": "198.35" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=CLJ&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=CLJ&departureDate=2020-03-24&returnDate=2020-03-28&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "KIV", "departureDate": "2020-03-26", "returnDate": "2020-03-28", "price": { "total": "201.50" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=KIV&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=KIV&departureDate=2020-03-26&returnDate=2020-03-28&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "BOS", "departureDate": "2020-03-07", "returnDate": "2020-03-08", "price": { "total": "268.45" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=BOS&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=BOS&departureDate=2020-03-07&returnDate=2020-03-08&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "ORL", "departureDate": "2020-03-17", "returnDate": "2020-03-18", "price": { "total": "298.93" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=ORL&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=ORL&departureDate=2020-03-17&returnDate=2020-03-18&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "FLL", "departureDate": "2020-03-16", "returnDate": "2020-03-17", "price": { "total": "341.61" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=FLL&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=FLL&departureDate=2020-03-16&returnDate=2020-03-17&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "ACC", "departureDate": "2020-04-10", "returnDate": "2020-04-12", "price": { "total": "383.57" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=ACC&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=ACC&departureDate=2020-04-10&returnDate=2020-04-12&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "SLC", "departureDate": "2020-03-31", "returnDate": "2020-04-01", "price": { "total": "394.93" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=SLC&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=SLC&departureDate=2020-03-31&returnDate=2020-04-01&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "KTM", "departureDate": "2020-05-01", "returnDate": "2020-05-14", "price": { "total": "448.03" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=KTM&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=KTM&departureDate=2020-05-01&returnDate=2020-05-14&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "SEA", "departureDate": "2020-03-05", "returnDate": "2020-03-10", "price": { "total": "463.85" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=SEA&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=SEA&departureDate=2020-03-05&returnDate=2020-03-10&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "SIN", "departureDate": "2020-04-30", "returnDate": "2020-05-04", "price": { "total": "482.40" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=SIN&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=SIN&departureDate=2020-04-30&returnDate=2020-05-04&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "PTY", "departureDate": "2020-03-09", "returnDate": "2020-03-19", "price": { "total": "484.95" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=PTY&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=PTY&departureDate=2020-03-09&returnDate=2020-03-19&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "TYO", "departureDate": "2020-03-22", "returnDate": "2020-03-24", "price": { "total": "499.24" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=TYO&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=TYO&departureDate=2020-03-22&returnDate=2020-03-24&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "SSA", "departureDate": "2020-03-24", "returnDate": "2020-04-08", "price": { "total": "506.02" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=SSA&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=SSA&departureDate=2020-03-24&returnDate=2020-04-08&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "CCS", "departureDate": "2020-02-28", "returnDate": "2020-03-10", "price": { "total": "510.19" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=CCS&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=CCS&departureDate=2020-02-28&returnDate=2020-03-10&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "MGA", "departureDate": "2020-04-01", "returnDate": "2020-04-12", "price": { "total": "514.39" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=MGA&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=MGA&departureDate=2020-04-01&returnDate=2020-04-12&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "RGN", "departureDate": "2020-03-10", "returnDate": "2020-03-15", "price": { "total": "528.17" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=RGN&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=RGN&departureDate=2020-03-10&returnDate=2020-03-15&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "OSA", "departureDate": "2020-04-10", "returnDate": "2020-04-16", "price": { "total": "531.45" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=OSA&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=OSA&departureDate=2020-04-10&returnDate=2020-04-16&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "DEN", "departureDate": "2020-03-06", "returnDate": "2020-03-11", "price": { "total": "542.62" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=DEN&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=DEN&departureDate=2020-03-06&returnDate=2020-03-11&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "MDZ", "departureDate": "2020-05-18", "returnDate": "2020-06-02", "price": { "total": "579.67" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=MDZ&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=MDZ&departureDate=2020-05-18&returnDate=2020-06-02&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "MTY", "departureDate": "2020-04-02", "returnDate": "2020-04-10", "price": { "total": "612.22" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=MTY&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=MTY&departureDate=2020-04-02&returnDate=2020-04-10&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "MLE", "departureDate": "2020-03-22", "returnDate": "2020-03-27", "price": { "total": "627.81" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=MLE&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=MLE&departureDate=2020-03-22&returnDate=2020-03-27&adults=1&nonStop=false" } }, { "type": "flight-destination", "origin": "MAD", "destination": "HNL", "departureDate": "2020-04-01", "returnDate": "2020-04-04", "price": { "total": "1283.29" }, "links": { "flightDates": "https://test.api.amadeus.com/v1/shopping/flight-dates?origin=MAD&destination=HNL&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DURATION", "flightOffers": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=MAD&destinationLocationCode=HNL&departureDate=2020-04-01&returnDate=2020-04-04&adults=1&nonStop=false" } } ], "dictionaries": { "currencies": { "EUR": "EURO" }, "locations": { "CLJ": { "subType": "AIRPORT", "detailedName": "CLUJ NAPOCA" }, "RIX": { "subType": "AIRPORT", "detailedName": "RIGA INTL" }, "KTM": { "subType": "AIRPORT", "detailedName": "TRIBHUVAN INTL" }, "KRK": { "subType": "AIRPORT", "detailedName": "JOHN PAUL II BALICE" }, "HNL": { "subType": "AIRPORT", "detailedName": "DANIEL K INOUYE INTL" }, "MLE": { "subType": "AIRPORT", "detailedName": "VELANA INTERNATIONAL" }, "FLL": { "subType": "AIRPORT", "detailedName": "FLL INTL" }, "ORL": { "subType": "AIRPORT", "detailedName": "EXECUTIVE" }, "SLC": { "subType": "AIRPORT", "detailedName": "SALT LAKE CITY INTL" }, "WAW": { "subType": "AIRPORT", "detailedName": "FREDERIC CHOPIN" }, "MTY": { "subType": "AIRPORT", "detailedName": "MARIANO ESCOBEDO INTL" }, "PTY": { "subType": "AIRPORT", "detailedName": "TOCUMEN INTL" }, "TLL": { "subType": "AIRPORT", "detailedName": "LENNART MERI" }, "GOA": { "subType": "AIRPORT", "detailedName": "CRISTOFORO COLOMBO" }, "DBV": { "subType": "AIRPORT", "detailedName": "DUBROVNIK" }, "MUC": { "subType": "AIRPORT", "detailedName": "MUNICH INTERNATIONAL" }, "OSA": { "subType": "CITY", "detailedName": "OSAKA" }, "PSA": { "subType": "AIRPORT", "detailedName": "GALILEO GALILEI" }, "SSA": { "subType": "AIRPORT", "detailedName": "D.L.E.MAGALHAES" }, "ACC": { "subType": "AIRPORT", "detailedName": "KOTOKA INTL" }, "MDZ": { "subType": "AIRPORT", "detailedName": "EL PLUMERILLO" }, "LWO": { "subType": "AIRPORT", "detailedName": "INTERNATIONAL" }, "MGA": { "subType": "AIRPORT", "detailedName": "AUGUSTO C.SANDINO INT" }, "BOS": { "subType": "AIRPORT", "detailedName": "EDWARD L LOGAN INTL" }, "LON": { "subType": "CITY", "detailedName": "LONDON" }, "TYO": { "subType": "CITY", "detailedName": "TOKYO" }, "DEN": { "subType": "AIRPORT", "detailedName": "DENVER INTERNATIONAL" }, "TUN": { "subType": "AIRPORT", "detailedName": "CARTHAGE" }, "GOT": { "subType": "AIRPORT", "detailedName": "LANDVETTER" }, "SEA": { "subType": "AIRPORT", "detailedName": "SEATTLE TACOMA INTL" }, "MAD": { "subType": "AIRPORT", "detailedName": "ADOLFO SUAREZ BARAJAS" }, "CCS": { "subType": "AIRPORT", "detailedName": "SIMON BOLIVAR INTL" }, "VIE": { "subType": "AIRPORT", "detailedName": "VIENNA INTERNATIONAL" }, "MOW": { "subType": "CITY", "detailedName": "MOSCOW" }, "RGN": { "subType": "AIRPORT", "detailedName": "MINGALADON" }, "ALC": { "subType": "AIRPORT", "detailedName": "ALICANTE AIRPORT" }, "KIV": { "subType": "AIRPORT", "detailedName": "INTERNATIONAL" }, "VCE": { "subType": "AIRPORT", "detailedName": "MARCO POLO" }, "REK": { "subType": "CITY", "detailedName": "REYKJAVIK" }, "SIN": { "subType": "AIRPORT", "detailedName": "CHANGI" }, "GLA": { "subType": "AIRPORT", "detailedName": "GLASGOW INTL" } } }, "meta": { "currency": "EUR", "links": { "self": "https://test.api.amadeus.com/v1/shopping/flight-destinations?origin=MAD&departureDate=2020-02-16,2020-08-13&oneWay=false&duration=1,15&nonStop=false&viewBy=DESTINATION" }, "defaults": { "departureDate": "2020-02-16,2020-08-13", "oneWay": false, "duration": "1,15", "nonStop": false, "viewBy": "DESTINATION" } } }
class Price {
final String total;
Price({this.total});
factory Price.fromJson(Map<String, dynamic> json) {
return Price(
total: json['total'],
);
}
}
class Links {
final String flightDates;
final String flightOffers;
Links({this.flightDates, this.flightOffers});
factory Links.fromJson(Map<String, dynamic> json) {
return Links(
flightDates: json['flightDates'],
flightOffers: json['flightOffers'],
);
}
}
class Data {
final String type;
final String origin;
final String destination;
final String departureDate;
final String returnDate;
final Price price;
final Links links;
Data({this.type, this.origin,this.destination,this.departureDate,this.returnDate,this.price,this.links});
factory Data.fromJson(Map<String, dynamic> parsedJson) {
return Data(
type: parsedJson['type'],
origin: parsedJson['origin'],
destination: parsedJson['destination'],
departureDate: parsedJson['departureDate'],
returnDate: parsedJson['returnDate'],
price: Price.fromJson(parsedJson['price'],),
links: Links.fromJson(parsedJson['links'],));}}
class Links2 {
final String total;
Links2({this.total});
factory Links2.fromJson(Map<String, dynamic> json) {
return Links2(
total: json['self'],
);
}
}
class Default {
final String departureDate;
final bool oneWay;
final String duration;
final bool nonStop;
final String viewBy;
Default({this.departureDate, this.oneWay,this.duration,this.nonStop,this.viewBy,});
factory Default.fromJson(Map<String, dynamic> parsedJson) {
return Default(
departureDate: parsedJson['departureDate'],
oneWay: parsedJson['oneWay'],
duration: parsedJson['duration'],
nonStop: parsedJson['nonStop'],
viewBy: parsedJson['viewBy'],
);}}
class Meta {
final String currency;
final Links2 links2;
final Default defaults;
Meta(
{this.currency, this.links2, this.defaults});
factory Meta.fromJson(Map<String, dynamic> json) {
return Meta(
currency: json['currency'],
links2: Links2.fromJson(json['links']),
defaults: Default.fromJson(json['defaults']),
);
}
}
class All {
final List<Data> data;
final Meta meta;
All(
{this.data, this.meta});
static List<Data> parseData(dataJson) {
var list = dataJson['data'] as List;
List<Data> dataList =
list.map((data) => Data.fromJson(data)).toList();
return dataList;
}
factory All.fromJson(Map<String, dynamic> json) {
return All(
meta: Meta.fromJson(json['meta'],),
data: parseData(json),
);
}
}
Future<String> loadAllFromAssets() async {
return await rootBundle.loadString('json/all.json');
}
Future loadAll() async {
String jsonString = await loadAllFromAssets();
final jsonResponse = json.decode(jsonString);
All all = new All.fromJson(jsonResponse);
print('Images: ${all.data[0].type}');
}
最佳答案
有一个名为:QuickType.io的网站链接:https://app.quicktype.io。
因此,根据您的json,我制作了一个如下所示的模型:
// To parse this JSON data, do
//
// final data = dataFromJson(jsonString);
import 'dart:convert';
Data dataFromJson(String str) => Data.fromJson(json.decode(str));
String dataToJson(Data data) => json.encode(data.toJson());
class Data {
List<Datum> data;
Dictionaries dictionaries;
Meta meta;
Data({
this.data,
this.dictionaries,
this.meta,
});
factory Data.fromJson(Map<String, dynamic> json) => Data(
data: List<Datum>.from(json["data"].map((x) => Datum.fromJson(x))),
dictionaries: Dictionaries.fromJson(json["dictionaries"]),
meta: Meta.fromJson(json["meta"]),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data.map((x) => x.toJson())),
"dictionaries": dictionaries.toJson(),
"meta": meta.toJson(),
};
}
class Datum {
Type type;
Origin origin;
String destination;
DateTime departureDate;
DateTime returnDate;
Price price;
DatumLinks links;
Datum({
this.type,
this.origin,
this.destination,
this.departureDate,
this.returnDate,
this.price,
this.links,
});
factory Datum.fromJson(Map<String, dynamic> json) => Datum(
type: typeValues.map[json["type"]],
origin: originValues.map[json["origin"]],
destination: json["destination"],
departureDate: DateTime.parse(json["departureDate"]),
returnDate: DateTime.parse(json["returnDate"]),
price: Price.fromJson(json["price"]),
links: DatumLinks.fromJson(json["links"]),
);
Map<String, dynamic> toJson() => {
"type": typeValues.reverse[type],
"origin": originValues.reverse[origin],
"destination": destination,
"departureDate": "${departureDate.year.toString().padLeft(4, '0')}-${departureDate.month.toString().padLeft(2, '0')}-${departureDate.day.toString().padLeft(2, '0')}",
"returnDate": "${returnDate.year.toString().padLeft(4, '0')}-${returnDate.month.toString().padLeft(2, '0')}-${returnDate.day.toString().padLeft(2, '0')}",
"price": price.toJson(),
"links": links.toJson(),
};
}
class DatumLinks {
String flightDates;
String flightOffers;
DatumLinks({
this.flightDates,
this.flightOffers,
});
factory DatumLinks.fromJson(Map<String, dynamic> json) => DatumLinks(
flightDates: json["flightDates"],
flightOffers: json["flightOffers"],
);
Map<String, dynamic> toJson() => {
"flightDates": flightDates,
"flightOffers": flightOffers,
};
}
enum Origin { MAD }
final originValues = EnumValues({
"MAD": Origin.MAD
});
class Price {
String total;
Price({
this.total,
});
factory Price.fromJson(Map<String, dynamic> json) => Price(
total: json["total"],
);
Map<String, dynamic> toJson() => {
"total": total,
};
}
enum Type { FLIGHT_DESTINATION }
final typeValues = EnumValues({
"flight-destination": Type.FLIGHT_DESTINATION
});
class Dictionaries {
Currencies currencies;
Map<String, Location> locations;
Dictionaries({
this.currencies,
this.locations,
});
factory Dictionaries.fromJson(Map<String, dynamic> json) => Dictionaries(
currencies: Currencies.fromJson(json["currencies"]),
locations: Map.from(json["locations"]).map((k, v) => MapEntry<String, Location>(k, Location.fromJson(v))),
);
Map<String, dynamic> toJson() => {
"currencies": currencies.toJson(),
"locations": Map.from(locations).map((k, v) => MapEntry<String, dynamic>(k, v.toJson())),
};
}
class Currencies {
String eur;
Currencies({
this.eur,
});
factory Currencies.fromJson(Map<String, dynamic> json) => Currencies(
eur: json["EUR"],
);
Map<String, dynamic> toJson() => {
"EUR": eur,
};
}
class Location {
SubType subType;
String detailedName;
Location({
this.subType,
this.detailedName,
});
factory Location.fromJson(Map<String, dynamic> json) => Location(
subType: subTypeValues.map[json["subType"]],
detailedName: json["detailedName"],
);
Map<String, dynamic> toJson() => {
"subType": subTypeValues.reverse[subType],
"detailedName": detailedName,
};
}
enum SubType { AIRPORT, CITY }
final subTypeValues = EnumValues({
"AIRPORT": SubType.AIRPORT,
"CITY": SubType.CITY
});
class Meta {
String currency;
MetaLinks links;
Defaults defaults;
Meta({
this.currency,
this.links,
this.defaults,
});
factory Meta.fromJson(Map<String, dynamic> json) => Meta(
currency: json["currency"],
links: MetaLinks.fromJson(json["links"]),
defaults: Defaults.fromJson(json["defaults"]),
);
Map<String, dynamic> toJson() => {
"currency": currency,
"links": links.toJson(),
"defaults": defaults.toJson(),
};
}
class Defaults {
String departureDate;
bool oneWay;
String duration;
bool nonStop;
String viewBy;
Defaults({
this.departureDate,
this.oneWay,
this.duration,
this.nonStop,
this.viewBy,
});
factory Defaults.fromJson(Map<String, dynamic> json) => Defaults(
departureDate: json["departureDate"],
oneWay: json["oneWay"],
duration: json["duration"],
nonStop: json["nonStop"],
viewBy: json["viewBy"],
);
Map<String, dynamic> toJson() => {
"departureDate": departureDate,
"oneWay": oneWay,
"duration": duration,
"nonStop": nonStop,
"viewBy": viewBy,
};
}
class MetaLinks {
String self;
MetaLinks({
this.self,
});
factory MetaLinks.fromJson(Map<String, dynamic> json) => MetaLinks(
self: json["self"],
);
Map<String, dynamic> toJson() => {
"self": self,
};
}
class EnumValues<T> {
Map<String, T> map;
Map<T, String> reverseMap;
EnumValues(this.map);
Map<T, String> get reverse {
if (reverseMap == null) {
reverseMap = map.map((k, v) => new MapEntry(v, k));
}
return reverseMap;
}
}
关于json - Flutter从Rest API解析.JSON,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60243327/
我一直在使用 AJAX 从我正在创建的网络服务中解析 JSON 数组时遇到问题。我的前端是一个简单的 ajax 和 jquery 组合,用于显示从我正在创建的网络服务返回的结果。 尽管知道我的数据库查
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 1
我在尝试运行 Android 应用程序时遇到问题并收到以下错误 java.lang.NoClassDefFoundError: com.parse.Parse 当我尝试运行该应用时。 最佳答案 在这
有什么办法可以防止etree在解析HTML内容时解析HTML实体吗? html = etree.HTML('&') html.find('.//body').text 这给了我 '&' 但我想
我有一个有点疯狂的例子,但对于那些 JavaScript 函数作用域专家来说,它看起来是一个很好的练习: (function (global) { // our module number one
关闭。此题需要details or clarity 。目前不接受答案。 想要改进这个问题吗?通过 editing this post 添加详细信息并澄清问题. 已关闭 8 年前。 Improve th
我需要编写一个脚本来获取链接并解析链接页面的 HTML 以提取标题和其他一些数据,例如可能是简短的描述,就像您链接到 Facebook 上的内容一样。 当用户向站点添加链接时将调用它,因此在客户端启动
在 VS Code 中本地开发时,包解析为 C:/Users//AppData/Local/Microsoft/TypeScript/3.5/node_modules/@types//index而不是
我在将 json 从 php 解析为 javascript 时遇到问题 这是我的示例代码: //function MethodAjax = function (wsFile, param) {
我在将 json 从 php 解析为 javascript 时遇到问题 这是我的示例代码: //function MethodAjax = function (wsFile, param) {
我被赋予了将一种语言“翻译”成另一种语言的工作。对于使用正则表达式的简单逐行方法来说,源代码过于灵活(复杂)。我在哪里可以了解更多关于词法分析和解析器的信息? 最佳答案 如果你想对这个主题产生“情绪化
您好,我在解析此文本时遇到问题 { { { {[system1];1;1;0.612509325}; {[system2];1;
我正在为 adobe after effects 在 extendscript 中编写一些代码,最终变成了 javascript。 我有一个数组,我想只搜索单词“assemble”并返回整个 jc3_
我有这段代码: $(document).ready(function() { // }); 问题:FB_RequireFeatures block 外部的代码先于其内部的代码执行。因此 who
背景: netcore项目中有些服务是在通过中间件来通信的,比如orleans组件。它里面服务和客户端会指定网关和端口,我们只需要开放客户端给外界,服务端关闭端口。相当于去掉host,这样省掉了些
1.首先贴上我试验成功的代码 复制代码 代码如下: protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
什么是 XML? XML 指可扩展标记语言(eXtensible Markup Language),标准通用标记语言的子集,是一种用于标记电子文件使其具有结构性的标记语言。 你可以通过本站学习 X
【PHP代码】 复制代码 代码如下: $stmt = mssql_init('P__Global_Test', $conn) or die("initialize sto
在SQL查询分析器执行以下代码就可以了。 复制代码代码如下: declare @t varchar(255),@c varchar(255) declare table_cursor curs
前言 最近练习了一些前端算法题,现在做个总结,以下题目都是个人写法,并不是标准答案,如有错误欢迎指出,有对某道题有新的想法的友友也可以在评论区发表想法,互相学习🤭 题目 题目一: 二维数组中的
我是一名优秀的程序员,十分优秀!