@anilanwane what is not working with your script? It's working fine for me. I tested on the below sample and the output was only 1 line and not 2.
{
"Id": "Id",
"IsDeleted": "IsDeleted",
"IsPrivate": "IsPrivate",
"Name": "Name",
"Description": "Description",
"StageName": "StageName",
"Amount": "Amount",
"Probability": "Probability",
"ExpectedRevenue": "ExpectedRevenue",
"TotalOpportunityQuantity": "TotalOpportunityQuantity",
"CloseDate": "CloseDate",
"Type": "Type",
"NextStep": "NextStep",
"LeadSource": "LeadSource",
"IsClosed": "IsClosed",
"IsWon": "IsWon",
"ForecastCategory": "ForecastCategory",
"ForecastCategoryName": "ForecastCategoryName",
"HasOpportunityLineItem": "HasOpportunityLineItem",
"CreatedDate": "CreatedDate",
"LastModifiedDate": "LastModifiedDate",
"SystemModstamp": "SystemModstamp",
"LastActivityDate": "LastActivityDate",
"PushCount": "PushCount",
"LastStageChangeDate": "LastStageChangeDate",
"FiscalQuarter": "FiscalQuarter",
"FiscalYear": "FiscalYear",
"Fiscal": "Fiscal",
"ContactId": "ContactId",
"LastViewedDate": "LastViewedDate",
"LastReferencedDate": "LastReferencedDate",
"HasOpenActivity": "HasOpenActivity",
"HasOverdueTask": "HasOverdueTask",
"DeliveryInstallationStatus__c": "DeliveryInstallationStatus__c",
"TrackingNumber__c": "TrackingNumber__c",
"NetSuiteSalesOrder__c": "NetSuiteSalesOrder__c",
"CurrentGenerators__c": "CurrentGenerators__c",
"MainCompetitors__c": "MainCompetitors__c",
"Ammendment_Opportunity_Type__c": "Ammendment_Opportunity_Type__c",
"RA_Source_Document__c": "RA_Source_Document__c",
"Account": {
"Id": "Account.Id"
},
"OpportunityLineItems": [
{
"Id": "Id",
"SortOrder": "SortOrder",
"ProductCode": "ProductCode",
"Name": "Name",
"Quantity": "Quantity",
"TotalPrice": "TotalPrice",
"UnitPrice": "UnitPrice",
"ListPrice": "ListPrice",
"ServiceDate": "ServiceDate",
"Description": "Description",
"CreatedDate": "CreatedDate",
"LastModifiedDate": "LastModifiedDate",
"SystemModstamp": "SystemModstamp",
"IsDeleted": "IsDeleted",
"LastViewedDate": "LastViewedDate",
"LastReferencedDate": "LastReferencedDate",
"DoNotSync__c": "false",
"End_Date__c": "End_Date__c",
"Start_Date__c": "Start_Date__c",
"Product2": {
"NetSuite_Item_ID__c": "Product2.NetSuite_Item_ID__c"
}
},
{
"Id": "Id",
"SortOrder": "SortOrder",
"ProductCode": "ProductCode",
"Name": "Name",
"Quantity": "Quantity",
"TotalPrice": "TotalPrice",
"UnitPrice": "UnitPrice",
"ListPrice": "ListPrice",
"ServiceDate": "ServiceDate",
"Description": "Description",
"CreatedDate": "CreatedDate",
"LastModifiedDate": "LastModifiedDate",
"SystemModstamp": "SystemModstamp",
"IsDeleted": "IsDeleted",
"LastViewedDate": "LastViewedDate",
"LastReferencedDate": "LastReferencedDate",
"DoNotSync__c": "true",
"End_Date__c": "End_Date__c",
"Start_Date__c": "Start_Date__c",
"Product2": {
"NetSuite_Item_ID__c": "Product2.NetSuite_Item_ID__c"
}
}
]
}