- 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/
最近开始学习MongoDB。今天老师教了我们 mongoexport 命令。在练习时,我遇到了一个典型的问题,包括教练在内的其他同学都没有遇到过。我在我的 Windows 10 机器上使用 Mongo
我是 JSON Schema 的新手,读过什么是 JSON Schema 等等。但我不知道如何将 JSON Schema 链接到 JSON 以针对该 JSON Schema 进行验证。谁能解释一下?
在 xml 中,我可以在另一个 xml 文件中包含一个文件并使用它。如果您的软件从 xml 获取配置文件但没有任何方法来分离配置,如 apache/ngnix(nginx.conf - site-av
我有一个 JSON 对象,其中包含一个本身是 JSON 对象的字符串。我如何反序列化它? 我希望能够做类似的事情: #[derive(Deserialize)] struct B { c: S
考虑以下 JSON { "a": "{\"b\": 12, \"c\": \"test\"}" } 我想定义一个泛型读取 Reads[Outer[T]]对于这种序列化的 Json import
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 11 个月前关闭。 Improve
我的旧项目在 MySQL 中有 Standard JSON 格式的数据。 对于我在 JS (Node.js) 和 DynamoDB 中的全新项目,关于 Standard JSON格式: 是否建议将其转
JSON 值字符串、数字、true、false、null 是否是有效的 JSON? 即,是 true 一个有效的 JSON 文档?还是必须是数组/对象? 一些验证器接受这个(例如 http://jso
我有一个 JSON 字符串,其中一个字段是文本字段。这个文本字段可以包含用户在 UI 中输入的文本,如果他们输入的文本是 JSON 文本,也许是为了说明一些编码,我需要对他们的文本进行编码,以便它不会
我正在通过 IBM MQ 调用处理数据,当由 ColdFusion 10 (10,0,11,285437) 序列化时,0 将作为 +0.0 返回,它会导致无效的 JSON并且无法反序列化。 stPol
我正在从三个数组中生成一个散列,然后尝试构建一个 json。我通过 json object has array 成功了。 require 'json' A = [['A1', 'A2', 'A3'],
我从 API 接收 JSON,响应可以是 30 种类型之一。每种类型都有一组唯一的字段,但所有响应都有一个字段 type 说明它是哪种类型。 我的方法是使用serde .我为每种响应类型创建一个结构并
我正在下载一个 JSON 文件,我已将其检查为带有“https://jsonlint.com”的有效 JSON 到文档目录。然后我打开文件并再次检查,结果显示为无效的 JSON。这怎么可能????这是
我正在尝试根据从 API 接收到的数据动态创建一个 JSON 对象。 收到的示例数据:将数据解码到下面给出的 CiItems 结构中 { "class_name": "test", "
我想从字符串转换为对象。 来自 {"key1": "{\n \"key2\": \"value2\",\n \"key3\": {\n \"key4\": \"value4\"\n }\n
目前我正在使用以下代码将嵌套的 json 转换为扁平化的 json: import ( "fmt" "github.com/nytlabs/gojsonexplode" ) func
我有一个使用来自第三方 API 的数据的应用程序。我需要将 json 解码为一个结构,这需要该结构具有“传入”json 字段的 json 标签。传出的 json 字段具有不同的命名约定,因此我需要不同
我想使用 JSON 架构来验证某些值。我有两个对象,称它们为 trackedItems 和 trackedItemGroups。 trackedItemGroups 是组名称和 trackedItem
考虑以下案例类模式, case class Y (a: String, b: String) case class X (dummy: String, b: Y) 字段b是可选的,我的一些数据集没有字
我正在存储 cat ~/path/to/file/blah | 的输出jq tojson 在一个变量中,稍后在带有 JSON 内容的 curl POST 中使用。它运作良好,但它删除了所有换行符。我知
我是一名优秀的程序员,十分优秀!