我是新来的震动和有困难的时间获得预期的产出
输入JSON
[
{
"getPatientDemographicDetailsOutput": [
{
"Message": "SUCCESS",
"Results": [
[
{
"APS_Age__c": "7 Years",
"Id": "1234",
"LastName": "LName0915-6",
"APS_DOB__c": "2014-11-25",
"Contacts__r": {
"totalSize": 2,
"records": [
{
"Alternate_Phone_1__c": "1458296321",
"Alternate_Phone_2__c": "(732) 318-3232",
"Correspondence_City__c": "Charlotte",
"Email_Address__c": "sohel@abc.com",
"Correspondence_State__c": "NC",
"State__c": "NC",
"Patient__c": "1234",
"Correspondence_Time_Zone__c": "EST",
"Correspondence_ZipCode_Name__c": "28222",
"Primary__c": true,
"Primary_Phone__c": "Mobile",
"Correspondence_Country__c": "USA",
"Country__c": "USA",
"Address_Line_2__c": "City",
"City__c": "Charlotte",
"Type__c": "Self",
"Zip_Code_Name__c": "28222",
"Address_Line_1__c": "Bangalore",
"Id": "11111",
"Correspond_Address_Line_1__c": "Bangalore",
"Correspond_Address_Line_2__c": "City",
"Mobile_Phone_for_Campaigns__c": "+1(732) 318-1232"
},
{
"Correspondence_City__c": "INTERNAL REVENUE SERVICE",
"Correspondence_State__c": "NY",
"Type__c": "Caregiver",
"Patient__c": "1234",
"Id": "22222",
"Correspond_Address_Line_1__c": "test address",
"Correspondence_Time_Zone__c": "EST",
"Correspondence_ZipCode_Name__c": "00501",
"Primary__c": false,
"Correspondence_Country__c": "USA"
}
],
"done": true
}
}
],
[
{
"Contact__c": "11111",
"Text_Consent_Date__c": "2019-11-23",
"Text_Messaging__c": "Yes",
"Id": "54545454"
}
]
]
}
]
}
]预期产出
[
{
"APS_Age__c": "7 Years",
"Id": "1234",
"LastName": "LName0915-6",
"APS_DOB__c": "2014-11-25",
"Alternate_Phone_1__c": "1458296321",
"Alternate_Phone_2__c": "(732) 318-3232",
"Correspondence_City__c": "Charlotte",
"Correspond_Address_Line_1__c": "Bangalore",
"Correspond_Address_Line_2__c": "City",
"Mobile_Phone_for_Campaigns__c": "+1(732) 318-1232",
"Primary__c": true,
"Text_Consent_Date__c": "2019-11-23",
"Text_Messaging__c": "Yes"
}
]转换后两个字段的逻辑-- Text_Consent_Date__c和Text_Messaging__c
匹配
发布于 2022-10-13 05:56:32
此shift操作将帮助您生成所需的json:
[
{
"operation": "shift",
"spec": {
"*": {
"getPatientDemographicDetailsOutput": {
"*": {
"Results": {
"*": {
"*": {
"*": "[&2].&",
"Contacts__r": {
"records": {
"*": {
"Alternate_Phone_1__c": "[&1].&",
"Alternate_Phone_2__c": "[&1].&",
"Correspondence_City__c": "[&1].&",
"Correspond_Address_Line_1__c": "[&1].&",
"Correspond_Address_Line_2__c": "[&1].&",
"Mobile_Phone_for_Campaigns__c": "[&1].&",
"Primary__c": "[&1].&"
}
}
},
"Text_Consent_Date__c": "[&1].&",
"Text_Messaging__c": "[&1].&"
}
}
}
}
}
}
}
}
]https://stackoverflow.com/questions/74048600
复制相似问题