我想从json下面删除'_id'?
var json = {'@Version': '0', 'AirReservation': {'AirItinerary': {'OriginDestinationOptions': {'OriginDestinationOption': {'@RefNumber': '0', '@DirectionId': '0', '@ElapsedTime': '0320', 'FlightSegment': {'@DepartureDateTime': '2018-04-09T05:30:00', '@ArrivalDateTime': '2018-04-09T07:20:00', '@FlightNumber': '873', '@ResBookDesigCode': 'V', '@Status': 'HK', 'FlightDuration': '2018-04-03T03:20:00', 'DepartureAirport': {'@LocationCode': 'IKA', '@Terminal': ''}, 'ArrivalAirport': {'@LocationCode': 'IST', '@Terminal': 'I'}, 'OperatingAirline': {'@Code': 'TK'}, 'Equipment': {'@AirEquipType': '332'}, 'MarketingAirline': {'@Code': 'TK'}, 'BookingClassAvails': {'BookingClassAvail': {'@ResBookDesigCode': 'V', '@ResBookDesigQuantity': '9', '@RPH': 'ADT', '@AvailablePTC': 'ADT', '@ResBookDesigCabinCode': 'M', '@FareBasis': 'VLY1PXOW'}}}}}}, 'PriceInfo': {'ItinTotalFare': {'BaseFare': {'@Currency': 'TRY', '@Amount': '521.00'}, 'MarkupFare': {'@Amount': '0'}, 'TotalFare': {'@Amount': '569.04', '@Currency': 'TRY'}, 'TotalAmountInTicketingCurrency': {'@Amount': '569.04', '@Currency': 'TRY'}}, 'PTC_FareBreakdowns': {'PTC_FareBreakdown': {'PassengerTypeQuantity': {'@Code': 'ADT', '@Quantity': '1'}, 'PassengerFare': {'BaseFare': {'@Amount': '521.00'}, 'MarkupFare': {'@Amount': '0'}, 'Taxes': {'Tax': {'@Amount': '48.04'}}, 'TotalFare': {'@Amount': '569.04'}}, 'TicketDesignators': {'TicketDesignator': [{'@TicketDesignatorCode': '70|PEN', '@TicketDesignatorExtension': 'TICKETS ARE NON-REFUNDABLE|'}, {'@TicketDesignatorCode': '41|LTD', '@TicketDesignatorExtension': 'LAST TKT DTE|09APR18| - DATE OF ORIGIN|'}]}}}, 'ServiceFees': {'ServiceFee': {'@Amount': '0', '@MarkupFeeAmount': '0', 'PassengerTypeQuantity': {'@Code': 'ADT', '@Quantity': '1'}}}}, 'TravelerInfo': {'AirTraveler': {'@PassengerTypeCode': 'ADT', 'NumberOfBaggages': '0', 'NumberOfBaggages1': '0', 'HandLuggages': '0', 'HandLuggages1': '0', 'PersonName': {'NamePrefix': 'MRS', 'GivenName': 'dd', 'Surname': 'ff'}, 'Telephone': {'@PhoneType': 'Home', '@LocationCode': '_+98091_2366554'}, 'Email': 'testss@gmail.com', 'Document': [{'@DocID': 'T12312233', '@DocType': 'DOCS', '@InnerDocType': 'Passport', '@ExpireDate': '2018-04-03', '@DocIssueCountry': ' 1002247'}, {'@DocIssueLocation': '', '@DocID': '1234567891236', '@DocType': 'DOCO', '@DocIssueCountry': ' 1002247'}, {'@DocType': 'DOCA', '@DocIssueCountry': ''}, {'@DocType': 'DOCA2', '@DocIssueCountry': ''}], 'BirthDate': '1996-05-02'}}, 'Fulfillment': {'PaymentDetails': {'PaymentDetail': {'@PaymentType': 'None', '@PaymentFPType': 'FPCA', 'BillingAddress': {'AddressLine': 'hbuyh hjgb hj hjgyg', 'CityName': 'Tehran', 'CountryName': {'@Code': 'IR'}}}}, 'DeliveryAddress': {'AddressLine': 'Iran Tehran', 'CityName': 'Tehran', 'CountryName': {'@Code': 'IR'}}}, 'Ticketing': {'@TicketTimeLimit': '2018-04-05T23:59:00', '@TicketType': 'BookingOnly'}, 'BookingReferenceID': {'@Type': 'F', '@ID_Context': 'QKC86K'}, 'FlightRulePenalties': {'FareRuleInfo': {'FareReference': 'VLY1PXOW', 'FilingAirline': {'@Code': 'TK'}, 'MarketingAirline': {'@Code': 'TK'}, 'DepartureAirport': {'@LocationCode': 'THR'}, 'ArrivalAirport': {'@LocationCode': 'IST'}, 'FareRules': {'SubSection': {'@SubTitle': 'PENALTIES', '@SubCode': 'PE', 'Paragraph': {'Text': 'FOR ROUND TRIP INSTANT PURCHASE FARES\n\n CHANGES\n\n ANY TIME\n CHARGE USD 50.00 FOR REISSUE/REVALIDATION.\n NOTE -\n A-BEFORE DEPARTURE-\n ITINERARY MUST BE RE-PRICED USING CURRENT FARES\n IN EFFECT ON THE DATE THE TICKET IS REISSUED\n THE ITINERARY MUST MEET ALL RULE PROVISIONS OF\n THE NEWLY TICKETED FARE INCLUDING ADVANCE\n RESERVATION\n -\n CHARGE APPLIES PER TRANSACTION - PER PERSON FOR\n ADULT CHILD AND INFANT WITH SEAT.\n INFANTS WITHOUT A SEAT ARE NOT CHARGED THE FEE\n -\n FOR TR DOMESTIC SECTORS- WITHOUT CHARGE\n -\n NEW FARE MAY BE EQUAL OR HIGHER. WHEN THE NEW\n ITINERARY RESULTS IN A HIGHER\n FARE THE DIFFERENCE WILL BE COLLECTED AND THE\n CHANGE FEE WILL BE APPLIED.\n -\n CHARGES SHALL NOT BE WAIVED FOR MEDICAL\n REASON\n -\n WHEN FARES ARE COMBINED THE MOST RESTRICTIVE\n CONDITIONS APPLY\n -\n -\n B-AFTER DEPARTURE-\n THE ITINERARY MUST BE RE-PRICED USING HISTORICAL\n FARES IN EFFECT ON THE ORIGINAL TICKETING DATE.\n THE NEW ITINERARY MUST MEET ALL THE RULE\n PROVISIONS OF THE NEWLY TICKETED FARES SUCH THAT\n THE RECALCULATED FARE COULD HAVE BEEN USED FOR\n THE NEW ITINERARY IF PURCHASED ON THE ORIGINAL\n TICKET ISSUE DATE\n -\n CHARGE APPLIES PER TRANSACTION - PER PERSON FOR\n ADULT CHILD AND INFANT WITH SEAT.\n INFANTS WITHOUT A SEAT ARE NOT CHARGED THE FEE\n -\n FOR TR DOMESTIC SECTORS- WITHOUT CHARGE\n -\n NEW FARE MAY BE EQUAL OR HIGHER. WHEN THE NEW\n ITINERARY RESULTS IN A HIGHER\n FARE THE DIFFERENCE WILL BE COLLECTED AND THE\n CHANGE FEE WILL BE APPLIED.\n -\n CHARGES SHALL NOT BE WAIVED FOR MEDICAL\n REASON\n -\n WHEN FARES ARE COMBINED THE MOST RESTRICTIVE\n CONDITIONS APPLY\n -\n -\n NOTE-\n SEQUENTIAL USE OF FLIGHT COUPONS - THIS FARE IS\n ONLY VALID IF THE FLIGHTS ARE TAKEN IN THE BOOKED\n SEQUENCE. OTHERWISE THE FARE WILL BE RECALCULATED\n BASED ON THE ACTUAL FLIGHT ROUTING.\n --\n\n CHANGES/CANCELLATIONS\n\n ANY TIME\n CHARGE USD 100.00 FOR NO-SHOW.\n NOTE -\n ---------\n CHARGES SHALL NOT BE WAIVED FOR MEDICAL REASON\n ---------\n CHILD DISCOUNT DOES NOT APPLY\n INFANT WITHOUT SEAT FREE OF CHARGE\n WHEN FARES ARE COMBINED THE MOST RESTRICTIVE\n CONDITIONS APPLY\n\n CANCELLATIONS\n\n BEFORE DEPARTURE\n CHARGE USD 50.00 FOR CANCEL/REFUND.\n NOTE -\n ANY TIME-\n -\n CHARGES SHALL NOT BE WAIVED FOR MEDICAL REASON\n --\n WHEN COMBINING FARES THE MOST RESTRICTIVE\n CANCELLATION CONDITIONS APPLY FOR THE ENTIRE\n PRICING UNIT\n ---\n CHILD DISCOUNT DOES NOT APPLY\n INFANT WITHOUT SEAT FREE OF CHARGE\n\n AFTER DEPARTURE\n CANCELLATIONS PERMITTED FOR CANCEL/REFUND.\n NOTE -\n FOR CANCELLATIONS AFTER DEPARTURE THE REFUND GIVEN\n WILL BE THE DIFFERENCE BETWEEN THE FARE PAID AND\n THE APPLICAPLE FARE FOR THE JOURNEY FLOWN.\n APPLICABLE FARE FOR THE JOURNEY FLOWN IS THE ONE\n THAT SET AT THE SAME RBD WITH THE ORIGINAL FARE\n PAID.\n IF NO FARE EXISTS FOR THE FLOWN JOURNEY\n ON THE SAME RBD WITH THE ORGINALFARE\n ANY FARE SET ON A HIGHER RBD WILL BE ACCEPTED.\n -----------------------------------\n WHEN FARES ARE COMBINED THE MOST RESTRICTIVE\n CONDITIONS APPLY'}}}}}, 'FlightMiniRules': 'null', 'PriceMessageInfo': {'PriceMessageInfo': {'MiniRulesPriceMessages': {'Text': 'null'}}}, 'PNRRemarks': {'PNRRemark': [{'@RemarkType': 'RM', '@RemarkCategory': '', '@Note': 'MEMBER_NAME:FirstName LastName'}, {'@RemarkType': 'RM', '@RemarkCategory': 'D', '@Note': 'DELIVERY TYPE: BookingOnly'}, {'@RemarkType': 'RM', '@RemarkCategory': 'A', '@Note': 'PORTAL: WSLACHIN'}, {'@RemarkType': 'RM', '@RemarkCategory': 'E', '@Note': 'FARE: 569.04 TRY'}, {'@RemarkType': 'RM', '@RemarkCategory': 'G', '@Note': 'PAYMENT TYPE: DEFAULT'}, {'@RemarkType': 'RC', '@RemarkCategory': '', '@Note': 'FLIGHT ADT TICKETFEE:TRY 569.04'}, {'@RemarkType': 'RM', '@RemarkCategory': '', '@Note': 'ASF FLIGHT TOTAL:TRY 569.04'}, {'@RemarkType': 'RM', '@RemarkCategory': '', '@Note': 'ASF PNR TOTAL:TRY 569.04'}, {'@RemarkType': 'RM', '@RemarkCategory': 'S', '@Note': 'SPECREQERR:INVALID TEXT DATA Type:DOCS P- 1002247-T12312233- 1002247-02MAY96-F-03APR18-FF-DD//H'}, {'@RemarkType': 'RM', '@RemarkCategory': 'S', '@Note': 'SPECREQERR:INVALID TEXT DATA Type:DOCO -V-1234567891236--- 1002247'}, {'@RemarkType': 'RC', '@RemarkCategory': '', '@Note': 'PRICING COMMANDFXP/R,UP,FC-TRY,VC-TK,THR.THR/LI/ET'}]}}, 'Success': 'null', '_id': ObjectId('5ac35d9fe138231d26bae955')}
删除json._id; 的console.log(JSON);
答案 0 :(得分:1)
简单致电delete a._id
let json = {
"@Version": "0",
"AirReservation": {
"AirItinerary": {
"OriginDestinationOptions": {
"OriginDestinationOption": {
"@RefNumber": "0",
"@DirectionId": "0",
"@ElapsedTime": "0320",
"FlightSegment": {
"@DepartureDateTime": "2018-04-09T05:30:00",
"@ArrivalDateTime": "2018-04-09T07:20:00",
"@FlightNumber": "873",
"@ResBookDesigCode": "V",
"@Status": "HK",
"FlightDuration": "2018-04-03T03:20:00",
"DepartureAirport": {
"@LocationCode": "IKA",
"@Terminal": ""
},
"ArrivalAirport": {
"@LocationCode": "IST",
"@Terminal": "I"
},
"OperatingAirline": {
"@Code": "TK"
},
"Equipment": {
"@AirEquipType": "332"
},
"MarketingAirline": {
"@Code": "TK"
},
"BookingClassAvails": {
"BookingClassAvail": {
"@ResBookDesigCode": "V",
"@ResBookDesigQuantity": "9",
"@RPH": "ADT",
"@AvailablePTC": "ADT",
"@ResBookDesigCabinCode": "M",
"@FareBasis": "VLY1PXOW"
}
}
}
}
}
},
"PriceInfo": {
"ItinTotalFare": {
"BaseFare": {
"@Currency": "TRY",
"@Amount": "521.00"
},
"MarkupFare": {
"@Amount": "0"
},
"TotalFare": {
"@Amount": "569.04",
"@Currency": "TRY"
},
"TotalAmountInTicketingCurrency": {
"@Amount": "569.04",
"@Currency": "TRY"
}
},
"PTC_FareBreakdowns": {
"PTC_FareBreakdown": {
"PassengerTypeQuantity": {
"@Code": "ADT",
"@Quantity": "1"
},
"PassengerFare": {
"BaseFare": {
"@Amount": "521.00"
},
"MarkupFare": {
"@Amount": "0"
},
"Taxes": {
"Tax": {
"@Amount": "48.04"
}
},
"TotalFare": {
"@Amount": "569.04"
}
},
"TicketDesignators": {
"TicketDesignator": [
{
"@TicketDesignatorCode": "70|PEN",
"@TicketDesignatorExtension": "TICKETS ARE NON-REFUNDABLE|"
},
{
"@TicketDesignatorCode": "41|LTD",
"@TicketDesignatorExtension": "LAST TKT DTE|09APR18| - DATE OF ORIGIN|"
}
]
}
}
},
"ServiceFees": {
"ServiceFee": {
"@Amount": "0",
"@MarkupFeeAmount": "0",
"PassengerTypeQuantity": {
"@Code": "ADT",
"@Quantity": "1"
}
}
}
},
"TravelerInfo": {
"AirTraveler": {
"@PassengerTypeCode": "ADT",
"NumberOfBaggages": "0",
"NumberOfBaggages1": "0",
"HandLuggages": "0",
"HandLuggages1": "0",
"PersonName": {
"NamePrefix": "MRS",
"GivenName": "dd",
"Surname": "ff"
},
"Telephone": {
"@PhoneType": "Home",
"@LocationCode": "_+98091_2366554"
},
"Email": "testss@gmail.com",
"Document": [
{
"@DocID": "T12312233",
"@DocType": "DOCS",
"@InnerDocType": "Passport",
"@ExpireDate": "2018-04-03",
"@DocIssueCountry": " 1002247"
},
{
"@DocIssueLocation": "",
"@DocID": "1234567891236",
"@DocType": "DOCO",
"@DocIssueCountry": " 1002247"
},
{
"@DocType": "DOCA",
"@DocIssueCountry": ""
},
{
"@DocType": "DOCA2",
"@DocIssueCountry": ""
}
],
"BirthDate": "1996-05-02"
}
},
"Fulfillment": {
"PaymentDetails": {
"PaymentDetail": {
"@PaymentType": "None",
"@PaymentFPType": "FPCA",
"BillingAddress": {
"AddressLine": "hbuyh hjgb hj hjgyg",
"CityName": "Tehran",
"CountryName": {
"@Code": "IR"
}
}
}
},
"DeliveryAddress": {
"AddressLine": "Iran Tehran",
"CityName": "Tehran",
"CountryName": {
"@Code": "IR"
}
}
},
"Ticketing": {
"@TicketTimeLimit": "2018-04-05T23:59:00",
"@TicketType": "BookingOnly"
},
"BookingReferenceID": {
"@Type": "F",
"@ID_Context": "QKC86K"
},
"FlightRulePenalties": {
"FareRuleInfo": {
"FareReference": "VLY1PXOW",
"FilingAirline": {
"@Code": "TK"
},
"MarketingAirline": {
"@Code": "TK"
},
"DepartureAirport": {
"@LocationCode": "THR"
},
"ArrivalAirport": {
"@LocationCode": "IST"
},
"FareRules": {
"SubSection": {
"@SubTitle": "PENALTIES",
"@SubCode": "PE",
"Paragraph": {
"Text": "FOR ROUND TRIP INSTANT PURCHASE FARES\n\n CHANGES\n\n ANY TIME\n CHARGE USD 50.00 FOR REISSUE/REVALIDATION.\n NOTE -\n A-BEFORE DEPARTURE-\n ITINERARY MUST BE RE-PRICED USING CURRENT FARES\n IN EFFECT ON THE DATE THE TICKET IS REISSUED\n THE ITINERARY MUST MEET ALL RULE PROVISIONS OF\n THE NEWLY TICKETED FARE INCLUDING ADVANCE\n RESERVATION\n -\n CHARGE APPLIES PER TRANSACTION - PER PERSON FOR\n ADULT CHILD AND INFANT WITH SEAT.\n INFANTS WITHOUT A SEAT ARE NOT CHARGED THE FEE\n -\n FOR TR DOMESTIC SECTORS- WITHOUT CHARGE\n -\n NEW FARE MAY BE EQUAL OR HIGHER. WHEN THE NEW\n ITINERARY RESULTS IN A HIGHER\n FARE THE DIFFERENCE WILL BE COLLECTED AND THE\n CHANGE FEE WILL BE APPLIED.\n -\n CHARGES SHALL NOT BE WAIVED FOR MEDICAL\n REASON\n -\n WHEN FARES ARE COMBINED THE MOST RESTRICTIVE\n CONDITIONS APPLY\n -\n -\n B-AFTER DEPARTURE-\n THE ITINERARY MUST BE RE-PRICED USING HISTORICAL\n FARES IN EFFECT ON THE ORIGINAL TICKETING DATE.\n THE NEW ITINERARY MUST MEET ALL THE RULE\n PROVISIONS OF THE NEWLY TICKETED FARES SUCH THAT\n THE RECALCULATED FARE COULD HAVE BEEN USED FOR\n THE NEW ITINERARY IF PURCHASED ON THE ORIGINAL\n TICKET ISSUE DATE\n -\n CHARGE APPLIES PER TRANSACTION - PER PERSON FOR\n ADULT CHILD AND INFANT WITH SEAT.\n INFANTS WITHOUT A SEAT ARE NOT CHARGED THE FEE\n -\n FOR TR DOMESTIC SECTORS- WITHOUT CHARGE\n -\n NEW FARE MAY BE EQUAL OR HIGHER. WHEN THE NEW\n ITINERARY RESULTS IN A HIGHER\n FARE THE DIFFERENCE WILL BE COLLECTED AND THE\n CHANGE FEE WILL BE APPLIED.\n -\n CHARGES SHALL NOT BE WAIVED FOR MEDICAL\n REASON\n -\n WHEN FARES ARE COMBINED THE MOST RESTRICTIVE\n CONDITIONS APPLY\n -\n -\n NOTE-\n SEQUENTIAL USE OF FLIGHT COUPONS - THIS FARE IS\n ONLY VALID IF THE FLIGHTS ARE TAKEN IN THE BOOKED\n SEQUENCE. OTHERWISE THE FARE WILL BE RECALCULATED\n BASED ON THE ACTUAL FLIGHT ROUTING.\n --\n\n CHANGES/CANCELLATIONS\n\n ANY TIME\n CHARGE USD 100.00 FOR NO-SHOW.\n NOTE -\n ---------\n CHARGES SHALL NOT BE WAIVED FOR MEDICAL REASON\n ---------\n CHILD DISCOUNT DOES NOT APPLY\n INFANT WITHOUT SEAT FREE OF CHARGE\n WHEN FARES ARE COMBINED THE MOST RESTRICTIVE\n CONDITIONS APPLY\n\n CANCELLATIONS\n\n BEFORE DEPARTURE\n CHARGE USD 50.00 FOR CANCEL/REFUND.\n NOTE -\n ANY TIME-\n -\n CHARGES SHALL NOT BE WAIVED FOR MEDICAL REASON\n --\n WHEN COMBINING FARES THE MOST RESTRICTIVE\n CANCELLATION CONDITIONS APPLY FOR THE ENTIRE\n PRICING UNIT\n ---\n CHILD DISCOUNT DOES NOT APPLY\n INFANT WITHOUT SEAT FREE OF CHARGE\n\n AFTER DEPARTURE\n CANCELLATIONS PERMITTED FOR CANCEL/REFUND.\n NOTE -\n FOR CANCELLATIONS AFTER DEPARTURE THE REFUND GIVEN\n WILL BE THE DIFFERENCE BETWEEN THE FARE PAID AND\n THE APPLICAPLE FARE FOR THE JOURNEY FLOWN.\n APPLICABLE FARE FOR THE JOURNEY FLOWN IS THE ONE\n THAT SET AT THE SAME RBD WITH THE ORIGINAL FARE\n PAID.\n IF NO FARE EXISTS FOR THE FLOWN JOURNEY\n ON THE SAME RBD WITH THE ORGINALFARE\n ANY FARE SET ON A HIGHER RBD WILL BE ACCEPTED.\n -----------------------------------\n WHEN FARES ARE COMBINED THE MOST RESTRICTIVE\n CONDITIONS APPLY"
}
}
}
}
},
"FlightMiniRules": "null",
"PriceMessageInfo": {
"PriceMessageInfo": {
"MiniRulesPriceMessages": {
"Text": "null"
}
}
},
"PNRRemarks": {
"PNRRemark": [
{
"@RemarkType": "RM",
"@RemarkCategory": "",
"@Note": "MEMBER_NAME:FirstName LastName"
},
{
"@RemarkType": "RM",
"@RemarkCategory": "D",
"@Note": "DELIVERY TYPE: BookingOnly"
},
{
"@RemarkType": "RM",
"@RemarkCategory": "A",
"@Note": "PORTAL: WSLACHIN"
},
{
"@RemarkType": "RM",
"@RemarkCategory": "E",
"@Note": "FARE: 569.04 TRY"
},
{
"@RemarkType": "RM",
"@RemarkCategory": "G",
"@Note": "PAYMENT TYPE: DEFAULT"
},
{
"@RemarkType": "RC",
"@RemarkCategory": "",
"@Note": "FLIGHT ADT TICKETFEE:TRY 569.04"
},
{
"@RemarkType": "RM",
"@RemarkCategory": "",
"@Note": "ASF FLIGHT TOTAL:TRY 569.04"
},
{
"@RemarkType": "RM",
"@RemarkCategory": "",
"@Note": "ASF PNR TOTAL:TRY 569.04"
},
{
"@RemarkType": "RM",
"@RemarkCategory": "S",
"@Note": "SPECREQERR:INVALID TEXT DATA Type:DOCS P- 1002247-T12312233- 1002247-02MAY96-F-03APR18-FF-DD//H"
},
{
"@RemarkType": "RM",
"@RemarkCategory": "S",
"@Note": "SPECREQERR:INVALID TEXT DATA Type:DOCO -V-1234567891236--- 1002247"
},
{
"@RemarkType": "RC",
"@RemarkCategory": "",
"@Note": "PRICING COMMANDFXP/R,UP,FC-TRY,VC-TK,THR.THR/LI/ET"
}
]
}
},
"Success": "null",
"_id": "ObjectId(\"5ac35d9fe138231d26bae955\")"
};
delete json._id;
console.log(json);
答案 1 :(得分:0)
您可以尝试删除运算符。删除将从对象中删除给定属性。
目前我没有自己可以使用的工具,但here是一个类似的问题,如果您无法将其删除,可能会对您有所帮助。
如果在尝试上述两种方法后仍然遇到问题,我建议提出问题:'如何访问此对象中的属性ID和值',因为您发布的对象似乎有点难以解析。
祝你好运!