我实际上正在寻找一个软件来转换我从web api获得的json文件(我是一个完整的json noobie),以便更好地加载到我的SQL数据库。几个小时谷歌研究后来我发现了jq,这几乎达到了我的需求100%。 我虽然为了我的需要在jq上找到了必要的过滤器操作,但现在运行的是“小”问题。我的源json是大量嵌套的,我需要从jsons路径中的不同层提取多个数据(来自对象/数组)。我在jqplay上构建了以下过滤器:
. | {cruise_nid: .nid} + {nights: .nights} + {zone: .zones[].title} + {sails_nid: .sails[].nid} + {arrival: .sails[].arrival} + {departure: .sails[].departure} + {cabintype: .sails[].cabins[].cabinType.kindName} + {catalogprice: .sails[].cabins[].catalogPrice} + {discountprice: .sails[].cabins[].discountPrice} + {currency: .sails[].cabins[].currency}
source json(简称):
{
"nid": 434508,
"nights": 121,
"zones": [
{
"nid": 35761,
"title": "Weltreise",
}
],
"sails": [
{
"nid": 434516,
"arrival": 1525644000,
"bookingServiceCode": "kreuzfahrt/c8a3/mit-der-columbus-einmal-um-die-ganze-welt-once-in-a-lifetime",
"departure": 1515193200,
"optionalFlightPrice": null,
"cabins": [
{
"cabinType": {
"nid": 379723,
"title": "Glückskabine Innen (Kat. IG): ",
"description": "Bei Buchung einer Garantiekabine überlassen Sie der Reederei die Wahl Ihrer Kabinennummer und Deck. Sie entscheiden sich für die Route, einen der zur Auswahl stehenden Termine, sowie die Kabinenkategorie. Für Ihre Flexibilität werden Sie mit attraktiven Vorzugspreisen belohnt.",
"bookingServiceCode": "IG",
"externalCode": "IG",
"kindId": 19,
"kindName": "Innenkabine",
"kind": "inside",
"validFrom": null,
"validTo": null,
"disabledForDirectBooking": false,
"bedQuantity": 2,
"maxPassengers": null,
"location": "",
"size": "",
"bed": "",
"windows": "",
"balcony": "",
"information": null,
"isGuaranteeCabin": true,
"guaranteeCabinInfo": "Bei Buchung einer Garantiekabine überlassen Sie der Reederei die Wahl Ihrer Kabinennummer und Deck. Sie entscheiden sich für die Route, einen der zur Auswahl stehenden Termine, sowie die Kabinenkategorie. Für Ihre Flexibilität werden Sie mit attraktiven Vorzugspreisen belohnt.",
"amenities": [],
"advantages": []
},
"state": 2,
"fees": "0",
"gratuities": "0",
"discountPrice": 9519,
"catalogPrice": 17879,
"discountPercentage": 0.4675876726886291,
"currency": "EUR"
},
{
"cabinType": {
"nid": 379730,
"title": "Innenkabine Standard (Kat. 1): ",
"description": "<ul>\r\n<li>Lage: Deck 5</li>\r\n<li>2 Einzelbetten</li>\r\n<li>Bad mit Dusche/WC</li>\r\n<li>Flatscreen-Fernseher</li>\r\n<li>Radio</li>\r\n<li>Minibar</li>\r\n<li>Direktwahl-Telefon</li>\r\n<li>Safe</li>\r\n<li>Individuell regulierbare Klimaanlage</li>\r\n<li>Bademäntel und Handtücher</li>\r\n<li>Föhn</li>\r\n</ul>\r\n",
"bookingServiceCode": "1",
"externalCode": "1",
"kindId": 19,
"kindName": "Innenkabine",
"kind": "inside",
"validFrom": null,
"validTo": null,
"disabledForDirectBooking": false,
"bedQuantity": 2,
"maxPassengers": null,
"location": "Deck 5",
"size": "18 m²",
"bed": "2 Einzelbetten",
"windows": "",
"balcony": "",
"information": null,
"isGuaranteeCabin": false,
"guaranteeCabinInfo": "",
"advantages": []
},
"state": 2,
"fees": "0",
"gratuities": "0",
"discountPrice": 10239,
"catalogPrice": 18599,
"discountPercentage": 0.44948653153395346,
"currency": "EUR"
},
{
"cabinType": {
"nid": 379731,
"title": "Innenkabine Standard Plus (Kat. 2): ",
"description": "<ul>\r\n<li>Lage: Deck 6</li>\r\n<li>2 Einzelbetten</li>\r\n<li>Bad mit Dusche/WC</li>\r\n<li>Flatscreen-Fernseher</li>\r\n<li>Radio</li>\r\n<li>Minibar</li>\r\n<li>Direktwahl-Telefon</li>\r\n<li>Safe</li>\r\n<li>Individuell regulierbare Klimaanlage</li>\r\n<li>Bademäntel und Handtücher</li>\r\n<li>Föhn</li>\r\n</ul>\r\n",
"bookingServiceCode": "2",
"externalCode": "2",
"kindId": 19,
"kindName": "Innenkabine",
"kind": "inside",
"validFrom": null,
"validTo": null,
"disabledForDirectBooking": false,
"bedQuantity": 2,
"maxPassengers": null,
"location": "Deck 6",
"size": "18 m²",
"bed": "2 Einzelbetten",
"windows": "",
"balcony": "",
"information": null,
"isGuaranteeCabin": false,
"guaranteeCabinInfo": "",
"advantages": []
},
"state": 2,
"fees": "0",
"gratuities": "0",
"discountPrice": 11299,
"catalogPrice": 20519,
"discountPercentage": 0.4493396364345241,
"currency": "EUR"
},
{
"cabinType": {
"nid": 379732,
"title": "Innenkabine Superior (Kat. 3): ",
"description": "<ul>\r\n<li>Lage: Deck 10</li>\r\n<li>2 Einzelbetten</li>\r\n<li>Bad mit Dusche/WC</li>\r\n<li>Flatscreen-Fernseher</li>\r\n<li>Radio</li>\r\n<li>Minibar</li>\r\n<li>Direktwahl-Telefon</li>\r\n<li>Safe</li>\r\n<li>Individuell regulierbare Klimaanlage</li>\r\n<li>Bademäntel und Handtücher</li>\r\n<li>Föhn</li>\r\n</ul>",
"bookingServiceCode": "3",
"externalCode": "3",
"kindId": 19,
"kindName": "Innenkabine",
"kind": "inside",
"validFrom": null,
"validTo": null,
"disabledForDirectBooking": false,
"bedQuantity": 2,
"maxPassengers": null,
"location": "Deck 10",
"size": "18 m²",
"bed": "2 Einzelbetten",
"windows": "",
"balcony": "",
"information": null,
"isGuaranteeCabin": false,
"guaranteeCabinInfo": "",
"advantages": []
},
"state": 1,
"fees": "0",
"gratuities": "0",
"discountPrice": 11999,
"catalogPrice": 21809,
"discountPercentage": 0.44981429684992436,
"currency": "EUR"
},
{
"cabinType": {
"nid": 379734,
"title": "Innenkabine Premium (Kat. 4): ",
"description": "<ul>\r\n<li>Lage: Deck 11</li>\r\n<li>2 Einzelbetten</li>\r\n<li>Bad mit Dusche/WC</li>\r\n<li>Flatscreen-Fernseher</li>\r\n<li>Radio</li>\r\n<li>Minibar</li>\r\n<li>Direktwahl-Telefon</li>\r\n<li>Safe</li>\r\n<li>Individuell regulierbare Klimaanlage</li>\r\n<li>Bademäntel und Handtücher</li>\r\n<li>Föhn</li>\r\n</ul>\r\n",
"bookingServiceCode": "4",
"externalCode": "4",
"kindId": 19,
"kindName": "Innenkabine",
"kind": "inside",
"validFrom": null,
"validTo": null,
"disabledForDirectBooking": false,
"bedQuantity": 2,
"maxPassengers": null,
"location": "Deck 11",
"size": "18 m²",
"bed": "2 Einzelbetten",
"windows": "",
"balcony": "",
"information": null,
"isGuaranteeCabin": false,
"guaranteeCabinInfo": "",
"advantages": []
},
"state": 1,
"fees": "0",
"gratuities": "0",
"discountPrice": 12709,
"catalogPrice": 23089,
"discountPercentage": 0.44956472779245527,
"currency": "EUR"
},
{
"cabinType": {
"nid": 379740,
"title": "Glückskabine Außen (Kat. OG): ",
"description": "Bei Buchung einer Garantiekabine überlassen Sie der Reederei die Wahl Ihrer Kabinennummer und Deck. Sie entscheiden sich für die Route, einen der zur Auswahl stehenden Termine, sowie die Kabinenkategorie. Für Ihre Flexibilität werden Sie mit attraktiven Vorzugspreisen belohnt.",
"bookingServiceCode": "OG",
"externalCode": "OG",
"kindId": 20,
"kindName": "Außenkabine",
"kind": "outside",
"validFrom": null,
"validTo": null,
"disabledForDirectBooking": false,
"bedQuantity": 2,
"maxPassengers": null,
"location": "",
"size": "",
"bed": "",
"windows": "Fenster",
"balcony": "",
"information": null,
"isGuaranteeCabin": true,
"guaranteeCabinInfo": "Bei Buchung einer Garantiekabine überlassen Sie der Reederei die Wahl Ihrer Kabinennummer und Deck. Sie entscheiden sich für die Route, einen der zur Auswahl stehenden Termine, sowie die Kabinenkategorie. Für Ihre Flexibilität werden Sie mit attraktiven Vorzugspreisen belohnt.",
"amenities": [],
"advantages": []
},
"state": 2,
"fees": "0",
"gratuities": "0",
"discountPrice": 12119,
"catalogPrice": 22739,
"discountPercentage": 0.4670390078719381,
"currency": "EUR"
},
{
"cabinType": {
"nid": 379748,
"title": "Außenkabine Standard mit eingeschränkter Sicht (Kat. 6C): ",
"description": "<ul>\r\n<li>Lage: Deck 8</li>\r\n<li>1 Doppelbett</li>\r\n<li>Bad mit Dusche/WC</li>\r\n<li>Fenster</li>\r\n<li>Flatscreen-Fernseher</li>\r\n<li>Radio</li>\r\n<li>Minibar</li>\r\n<li>Direktwahl-Telefon</li>\r\n<li>Safe</li>\r\n<li>Individuell regulierbare Klimaanlage</li>\r\n<li>Bademäntel und Handtücher</li>\r\n<li>Föhn</li>\r\n</ul>",
"bookingServiceCode": "6C",
"externalCode": "6C",
"kindId": 20,
"kindName": "Außenkabine",
"kind": "outside",
"validFrom": null,
"validTo": null,
"disabledForDirectBooking": false,
"bedQuantity": 2,
"maxPassengers": null,
"location": "Deck 8",
"size": "18 m²",
"bed": "1 Doppelbett",
"windows": "Fenster mit eingeschränkter Sicht",
"balcony": "",
"information": null,
"isGuaranteeCabin": false,
"guaranteeCabinInfo": "",
"advantages": []
},
"state": 1,
"fees": "0",
"gratuities": "0",
"discountPrice": 12989,
"catalogPrice": 23609,
"discountPercentage": 0.4498284552501165,
"currency": "EUR"
},
{
"cabinType": {
"nid": 379749,
"title": "Außenkabine Standard mit eingeschränkter Sicht (Kat. 6B): ",
"description": "<ul>\r\n<li>Lage: Deck 9</li>\r\n<li>1 Doppelbett</li>\r\n<li>Bad mit Dusche/WC</li>\r\n<li>Fenster</li>\r\n<li>Flatscreen-Fernseher</li>\r\n<li>Radio</li>\r\n<li>Minibar</li>\r\n<li>Direktwahl-Telefon</li>\r\n<li>Safe</li>\r\n<li>Individuell regulierbare Klimaanlage</li>\r\n<li>Bademäntel und Handtücher</li>\r\n<li>Föhn</li>\r\n</ul>",
"bookingServiceCode": "6B",
"externalCode": "6B",
"kindId": 20,
"kindName": "Außenkabine",
"kind": "outside",
"validFrom": null,
"validTo": null,
"disabledForDirectBooking": false,
"bedQuantity": 2,
"maxPassengers": null,
"location": "Deck 9",
"size": "18 m²",
"bed": "1 Doppelbett",
"windows": "Fenster mit eingeschränkter Sicht",
"balcony": "",
"information": null,
"isGuaranteeCabin": false,
"guaranteeCabinInfo": "",
"advantages": []
},
"state": 1,
"fees": "0",
"gratuities": "0",
"discountPrice": 13409,
"catalogPrice": 24379,
"discountPercentage": 0.4499774395996554,
"currency": "EUR"
},
{
"cabinType": {
"nid": 379750,
"title": "Außenkabine Standard (Kat. 6): ",
"description": "<ul>\r\n<li>Lage: Deck 4</li>\r\n<li>1 Doppelbett</li>\r\n<li>Bad mit Dusche/WC</li>\r\n<li>Bullauge</li>\r\n<li>Flatscreen-Fernseher</li>\r\n<li>Radio</li>\r\n<li>Minibar</li>\r\n<li>Direktwahl-Telefon</li>\r\n<li>Safe</li>\r\n<li>Individuell regulierbare Klimaanlage</li>\r\n<li>Bademäntel und Handtücher</li>\r\n<li>Föhn</li>\r\n</ul>",
"bookingServiceCode": "6",
"externalCode": "6",
"kindId": 20,
"kindName": "Außenkabine",
"kind": "outside",
"validFrom": null,
"validTo": null,
"disabledForDirectBooking": false,
"bedQuantity": 2,
"maxPassengers": null,
"location": "Deck 4",
"size": "18 m²",
"bed": "1 Doppelbett",
"windows": "Bullauge",
"balcony": "",
"information": null,
"isGuaranteeCabin": false,
"guaranteeCabinInfo": "",
"advantages": []
},
"state": 1,
"fees": "0",
"gratuities": "0",
"discountPrice": 14119,
"catalogPrice": 25659,
"discountPercentage": 0.4497447289450095,
"currency": "EUR"
},
{
"cabinType": {
"nid": 379751,
"title": "Außenkabine Standard (Kat. 7): ",
"description": "<ul>\r\n<li>Lage: Deck 6</li>\r\n<li>1 Doppelbett</li>\r\n<li>Bad mit Dusche/WC</li>\r\n<li>Fenster</li>\r\n<li>Flatscreen-Fernseher</li>\r\n<li>Radio</li>\r\n<li>Minibar</li>\r\n<li>Direktwahl-Telefon</li>\r\n<li>Safe</li>\r\n<li>Individuell regulierbare Klimaanlage</li>\r\n<li>Bademäntel und Handtücher</li>\r\n<li>Föhn</li>\r\n</ul>",
"bookingServiceCode": "7",
"externalCode": "7",
"kindId": 20,
"kindName": "Außenkabine",
"kind": "outside",
"validFrom": null,
"validTo": null,
"disabledForDirectBooking": false,
"bedQuantity": 2,
"maxPassengers": null,
"location": "Deck 6",
"size": "18 m²",
"bed": "1 Doppelbett",
"windows": "Fenster",
"balcony": "",
"information": null,
"isGuaranteeCabin": false,
"guaranteeCabinInfo": "",
"advantages": []
},
"state": 1,
"fees": "0",
"gratuities": "0",
"discountPrice": 14459,
"catalogPrice": 26299,
"discountPercentage": 0.4502072322141526,
"currency": "EUR"
},
{
"cabinType": {
"nid": 379752,
"title": "Außenkabine Standard Plus (Kat. 8): ",
"description": "<ul>\r\n<li>Lage: Deck 8 & 9</li>\r\n<li>1 Doppelbett</li>\r\n<li>Bad mit Dusche/WC</li>\r\n<li>Fenster</li>\r\n<li>Flatscreen-Fernseher</li>\r\n<li>Radio</li>\r\n<li>Minibar</li>\r\n<li>Direktwahl-Telefon</li>\r\n<li>Safe</li>\r\n<li>Individuell regulierbare Klimaanlage</li>\r\n<li>Bademäntel und Handtücher</li>\r\n<li>Föhn</li>\r\n</ul>",
"bookingServiceCode": "8",
"externalCode": "8",
"kindId": 20,
"kindName": "Außenkabine",
"kind": "outside",
"validFrom": null,
"validTo": null,
"disabledForDirectBooking": false,
"bedQuantity": 2,
"maxPassengers": null,
"location": "Deck 8 & 9",
"size": "18 m²",
"bed": "1 Doppelbett",
"windows": "Fenster",
"balcony": "",
"information": null,
"isGuaranteeCabin": false,
"guaranteeCabinInfo": "",
"advantages": []
},
"state": 1,
"fees": "0",
"gratuities": "0",
"discountPrice": 15169,
"catalogPrice": 27579,
"discountPercentage": 0.44998005728996704,
"currency": "EUR"
},
{
"cabinType": {
"nid": 379753,
"title": "Außenkabine Superior (Kat. 9): ",
"description": "<ul>\r\n<li>Lage: Deck 10</li>\r\n<li>1 Doppelbett</li>\r\n<li>Bad mit Dusche/WC</li>\r\n<li>Fenster</li>\r\n<li>Flatscreen-Fernseher</li>\r\n<li>Radio</li>\r\n<li>Minibar</li>\r\n<li>Direktwahl-Telefon</li>\r\n<li>Safe</li>\r\n<li>Individuell regulierbare Klimaanlage</li>\r\n<li>Bademäntel und Handtücher</li>\r\n<li>Föhn</li>\r\n</ul>",
"bookingServiceCode": "9",
"externalCode": "9",
"kindId": 20,
"kindName": "Außenkabine",
"kind": "outside",
"validFrom": null,
"validTo": null,
"disabledForDirectBooking": false,
"bedQuantity": 2,
"maxPassengers": null,
"location": "Deck 10",
"size": "18 m²",
"bed": "1 Doppelbett",
"windows": "Fenster",
"balcony": "",
"information": null,
"isGuaranteeCabin": false,
"guaranteeCabinInfo": "",
"advantages": []
},
"state": 1,
"fees": "0",
"gratuities": "0",
"discountPrice": 16939,
"catalogPrice": 30779,
"discountPercentage": 0.4496572338282595,
"currency": "EUR"
},
{
"cabinType": {
"nid": 379754,
"title": "Außenkabine Superior Plus (Kat. 11): ",
"description": "<ul>\r\n<li>Lage: Deck 10</li>\r\n<li>1 Doppelbett</li>\r\n<li>Bad mit Dusche/WC</li>\r\n<li>Fenster</li>\r\n<li>Flatscreen-Fernseher</li>\r\n<li>Radio</li>\r\n<li>Minibar</li>\r\n<li>Direktwahl-Telefon</li>\r\n<li>Safe</li>\r\n<li>Individuell regulierbare Klimaanlage</li>\r\n<li>Bademäntel und Handtücher</li>\r\n<li>Föhn</li>\r\n</ul>",
"bookingServiceCode": "11",
"externalCode": "11",
"kindId": 20,
"kindName": "Außenkabine",
"kind": "outside",
"validFrom": null,
"validTo": null,
"disabledForDirectBooking": false,
"bedQuantity": 2,
"maxPassengers": null,
"location": "Deck 10",
"size": "18 m²",
"bed": "1 Doppelbett",
"windows": "Fenster",
"balcony": "",
"information": null,
"isGuaranteeCabin": false,
"guaranteeCabinInfo": "",
"advantages": []
},
"state": 1,
"fees": "0",
"gratuities": "0",
"discountPrice": 18349,
"catalogPrice": 33349,
"discountPercentage": 0.4497885993583016,
"currency": "EUR"
},
{
"cabinType": {
"nid": 379756,
"title": "Außenkabine Premium (Kat. 12): ",
"description": "<ul>\r\n<li>Lage: Deck 11</li>\r\n<li>1 Doppelbett</li>\r\n<li>Bad mit Dusche/WC</li>\r\n<li>Fenster</li>\r\n<li>Flatscreen-Fernseher</li>\r\n<li>Radio</li>\r\n<li>Minibar</li>\r\n<li>Direktwahl-Telefon</li>\r\n<li>Safe</li>\r\n<li>Individuell regulierbare Klimaanlage</li>\r\n<li>Bademäntel und Handtücher</li>\r\n<li>Föhn</li>\r\n</ul>",
"bookingServiceCode": "12",
"externalCode": "12",
"kindId": 20,
"kindName": "Außenkabine",
"kind": "outside",
"validFrom": null,
"validTo": null,
"disabledForDirectBooking": false,
"bedQuantity": 2,
"maxPassengers": null,
"location": "Deck 11",
"size": "18 m²",
"bed": "1 Doppelbett",
"windows": "Fenster",
"balcony": "",
"information": null,
"isGuaranteeCabin": false,
"guaranteeCabinInfo": "",
"advantages": []
},
"state": 1,
"fees": "0",
"gratuities": "0",
"discountPrice": 19759,
"catalogPrice": 35909,
"discountPercentage": 0.44974797404550393,
"currency": "EUR"
},
{
"cabinType": {
"nid": 379758,
"title": "Innenkabine Superior zur Einzelbelegung (Kat. 5):",
"description": "<ul>\r\n<li>Lage: Deck 10</li>\r\n<li>1 Doppelbett</li>\r\n<li>Bad mit Dusche/WC</li>\r\n<li>Flatscreen-Fernseher</li>\r\n<li>Radio</li>\r\n<li>Minibar</li>\r\n<li>Direktwahl-Telefon</li>\r\n<li>Safe</li>\r\n<li>Individuell regulierbare Klimaanlage</li>\r\n<li>Bademäntel und Handtücher</li>\r\n<li>Föhn</li>\r\n</ul>",
"bookingServiceCode": "5",
"externalCode": "5",
"kindId": 19,
"kindName": "Innenkabine",
"kind": "inside",
"validFrom": null,
"validTo": null,
"disabledForDirectBooking": false,
"bedQuantity": 1,
"maxPassengers": null,
"location": "Deck 10",
"size": "18 m²",
"bed": "1 Doppelbett",
"windows": "",
"balcony": "",
"information": null,
"isGuaranteeCabin": false,
"guaranteeCabinInfo": "",
"advantages": []
},
"state": 2,
"fees": "0",
"gratuities": "0",
"discountPrice": 14989,
"catalogPrice": 27259,
"discountPercentage": 0.45012656370373083,
"currency": "EUR"
},
{
"cabinType": {
"nid": 379759,
"title": "Außenkabine zur Einzelbelegung (Kat. 7S): ",
"description": "<ul>\r\n<li>Lage: Deck 6</li>\r\n<li>1 Doppelbett</li>\r\n<li>Bad mit Dusche/WC</li>\r\n<li>Fenster</li>\r\n<li>Flatscreen-Fernseher</li>\r\n<li>Radio</li>\r\n<li>Minibar</li>\r\n<li>Direktwahl-Telefon</li>\r\n<li>Safe</li>\r\n<li>Individuell regulierbare Klimaanlage</li>\r\n<li>Bademäntel und Handtücher</li>\r\n<li>Föhn</li>\r\n</ul>",
"bookingServiceCode": "7S",
"externalCode": "7S",
"kindId": 20,
"kindName": "Außenkabine",
"kind": "outside",
"validFrom": null,
"validTo": null,
"disabledForDirectBooking": false,
"bedQuantity": 1,
"maxPassengers": null,
"location": "Deck 6",
"size": "18 m²",
"bed": "1 Doppelbett",
"windows": "Fenster",
"balcony": "",
"information": null,
"isGuaranteeCabin": false,
"guaranteeCabinInfo": "",
"advantages": []
},
"state": 2,
"fees": "0",
"gratuities": "0",
"discountPrice": 18089,
"catalogPrice": 32869,
"discountPercentage": 0.4496638169703976,
"currency": "EUR"
},
{
"cabinType": {
"nid": 379760,
"title": "Außenkabine zur Einzelbelegung (Kat. 8S): ",
"description": "<ul>\r\n<li>Lage: Deck 8 & 9</li>\r\n<li>1 Doppelbett</li>\r\n<li>Bad mit Dusche/WC</li>\r\n<li>Fenster</li>\r\n<li>Flatscreen-Fernseher</li>\r\n<li>Radio</li>\r\n<li>Minibar</li>\r\n<li>Direktwahl-Telefon</li>\r\n<li>Safe</li>\r\n<li>Individuell regulierbare Klimaanlage</li>\r\n<li>Bademäntel und Handtücher</li>\r\n<li>Föhn</li>\r\n</ul>",
"bookingServiceCode": "8S",
"externalCode": "8S",
"kindId": 20,
"kindName": "Außenkabine",
"kind": "outside",
"validFrom": null,
"validTo": null,
"disabledForDirectBooking": false,
"bedQuantity": 1,
"maxPassengers": null,
"location": "Deck 8 & 9",
"size": "18 m²",
"bed": "1 Doppelbett",
"windows": "Fenster",
"balcony": "",
"information": null,
"isGuaranteeCabin": false,
"guaranteeCabinInfo": "",
"advantages": []
},
"state": 1,
"fees": "0",
"gratuities": "0",
"discountPrice": 18959,
"catalogPrice": 34469,
"discountPercentage": 0.44996953784560034,
"currency": "EUR"
},
{
"cabinType": {
"nid": 379761,
"title": "Außenkabine Superior zur Einzelbelegung (Kat. 10):",
"description": "<ul>\r\n<li>Lage: Deck 10</li>\r\n<li>1 Doppelbett</li>\r\n<li>Bad mit Dusche/WC</li>\r\n<li>Fenster</li>\r\n<li>Flatscreen-Fernseher</li>\r\n<li>Radio</li>\r\n<li>Minibar</li>\r\n<li>Direktwahl-Telefon</li>\r\n<li>Safe</li>\r\n<li>Individuell regulierbare Klimaanlage</li>\r\n<li>Bademäntel und Handtücher</li>\r\n<li>Föhn</li>\r\n</ul>",
"bookingServiceCode": "10",
"externalCode": "10",
"kindId": 20,
"kindName": "Außenkabine",
"kind": "outside",
"validFrom": null,
"validTo": null,
"disabledForDirectBooking": false,
"bedQuantity": 1,
"maxPassengers": null,
"location": "Deck 10",
"size": "18 m²",
"bed": "1 Doppelbett",
"windows": "Fenster",
"balcony": "",
"information": null,
"isGuaranteeCabin": false,
"guaranteeCabinInfo": "",
"advantages": []
},
"state": 2,
"fees": "0",
"gratuities": "0",
"discountPrice": 21169,
"catalogPrice": 38479,
"discountPercentage": 0.44985576548247097,
"currency": "EUR"
},
{
"cabinType": {
"nid": 379762,
"title": "Außenkabine Standard (Kat. 6P): ",
"description": "<ul>\r\n<li>Lage: Deck 4</li>\r\n<li>1 Doppelbett</li>\r\n<li>Bad mit Dusche/WC</li>\r\n<li>Bullauge</li>\r\n<li>Flatscreen-Fernseher</li>\r\n<li>Radio</li>\r\n<li>Minibar</li>\r\n<li>Direktwahl-Telefon</li>\r\n<li>Safe</li>\r\n<li>Individuell regulierbare Klimaanlage</li>\r\n<li>Bademäntel und Handtücher</li>\r\n<li>Föhn</li>\r\n</ul>",
"bookingServiceCode": "6P",
"externalCode": "6P",
"kindId": 20,
"kindName": "Außenkabine",
"kind": "outside",
"validFrom": null,
"validTo": null,
"disabledForDirectBooking": false,
"bedQuantity": 2,
"maxPassengers": null,
"location": "Deck 4",
"size": "18 m²",
"bed": "1 Doppelbett",
"windows": "Bullauge",
"balcony": "",
"information": null,
"isGuaranteeCabin": false,
"guaranteeCabinInfo": "",
"advantages": []
},
"state": 1,
"fees": "0",
"gratuities": "0",
"discountPrice": 13409,
"catalogPrice": 24379,
"discountPercentage": 0.4499774395996554,
"currency": "EUR"
},
{
"cabinType": {
"nid": 379763,
"title": "Balkonkabine De Luxe (Kat. DL): ",
"description": "<ul>\r\n<li>Lage: Deck 11</li>\r\n<li>1 Doppelbett</li>\r\n<li>Bad mit Dusche/WC</li>\r\n<li>Balkon</li>\r\n<li>Flatscreen-Fernseher</li>\r\n<li>Radio</li>\r\n<li>Minibar</li>\r\n<li>Direktwahl-Telefon</li>\r\n<li>Safe</li>\r\n<li>Individuell regulierbare Klimaanlage</li>\r\n<li>Bademäntel und Handtücher</li>\r\n<li>Föhn</li>\r\n</ul>",
"bookingServiceCode": "DL",
"externalCode": "DL",
"kindId": 21,
"kindName": "Balkonkabine",
"kind": "balcony",
"validFrom": null,
"validTo": null,
"disabledForDirectBooking": false,
"bedQuantity": 2,
"maxPassengers": null,
"location": "Deck 11",
"size": "24 m²",
"bed": "1 Doppelbett",
"windows": "Raumhohe Fenster",
"balcony": "Balkon",
"information": null,
"isGuaranteeCabin": false,
"guaranteeCabinInfo": "",
"advantages": []
},
"state": 2,
"fees": "0",
"gratuities": "0",
"discountPrice": 28229,
"catalogPrice": 51299,
"discountPercentage": 0.44971636874013143,
"currency": "EUR"
},
{
"cabinType": {
"nid": 379764,
"title": "Junior Suite (Kat. JS) ",
"description": "<ul>\r\n<li>Lage: Deck 11</li>\r\n<li>1 Doppelbett</li>\r\n<li>Bad mit Dusche/WC</li>\r\n<li>Balkon</li>\r\n<li>Wohnbereich</li>\r\n<li>Flatscreen-Fernseher</li>\r\n<li>Radio</li>\r\n<li>Minibar</li>\r\n<li>Direktwahl-Telefon</li>\r\n<li>Safe</li>\r\n<li>Individuell regulierbare Klimaanlage</li>\r\n<li>Bademäntel und Handtücher</li>\r\n<li>Föhn</li>\r\n</ul>",
"bookingServiceCode": "JS",
"externalCode": "JS",
"kindId": 22,
"kindName": "Suite",
"kind": "suite",
"validFrom": null,
"validTo": null,
"disabledForDirectBooking": false,
"bedQuantity": 2,
"maxPassengers": null,
"location": "Deck 11",
"size": "35 m²",
"bed": "1 Doppelbett",
"windows": "Raumhohe Fenster",
"balcony": "Balkon",
"information": null,
"isGuaranteeCabin": false,
"guaranteeCabinInfo": "",
"amenities": [
"Bad mit Dusche/WC",
"Balkon",
"Wohnbereich",
"Flatscreen-Fernseher",
"Radio",
"Minibar",
"Direktwahl-Telefon",
"Safe",
"Individuell regulierbare Klimaanlage",
"Bademäntel und Handtücher",
"Föhn"
],
"advantages": []
},
"state": 2,
"fees": "0",
"gratuities": "0",
"discountPrice": 31739,
"catalogPrice": 57709,
"discountPercentage": 0.45001646190368916,
"currency": "EUR"
}
],
}
],
}
结果如下:
{
"cruise_nid": 434508,
"nights": 121,
"zone": "Weltreise",
"sails_nid": 434516,
"arrival": 1525644000,
"departure": 1515193200,
"cabintype": "Innenkabine",
"catalogprice": 17879,
"discountprice": 9519,
"currency": "EUR"
}
从json源码(100 kB)我预计会有30个这样的对象。但是我收到了194481个对象(大约50 MB文件)。我实际上不知道为什么会发生这种情况以及我如何解决它。有什么想法吗?
感谢
问候 蒂莫
答案 0 :(得分:0)
{nid, nights, zone: .zones[0].title} +
(.sails[0]
| { sails_nid: .nid, arrival, departure } +
(.cabins[0]
| { cabintype: .cabinType.kindName, catalogPrice, discountPrice, currency } ))
如果您想要区域,风帆和小屋的“所有组合”,只需将[0]替换为上面的[]:
{nid, nights, zone: .zones[].title} +
(.sails[]
| ({ sails_nid: .nid, arrival, departure } ) +
(.cabins[]
| { cabintype: .cabinType.kindName, catalogPrice, discountPrice, currency } ) )
使用示例输入,这会发出21个JSON对象。