从有效载荷Dateweave中提取文件

时间:2020-09-09 09:06:48

标签: dataweave mule4

Am试图仅从输入数据中提取两个字段并将其设置为变量inn mule 4

输入:

{
   "Id": "a9PV00000",
   "OwnerId": "00570000001c9fmAAA",
   "IsDeleted": "false",
   "Name": "Account",
   "CreatedDate": "2020-08-05T16:08:49.000Z",
   "CreatedById": "00570000001c9fmAAA",
   "LastModifiedDate": "2020-08-26T13:24:33.000Z",
   "LastModifiedById": "00570000001c9fmAAA",
   "SystemModstamp": "2020-09-04T13:09:57.000Z",
   "LastActivityDate": [],
   "LastViewedDate": "2020-09-09T08:10:29.000Z",
   "LastReferencedDate": "2020-09-09T08:10:29.000Z",
   "Object_API_Name__c": "Account",
   "Active__c": "true",
   "Upload_files_attachments__c": "true",
   "Delete_files_attachments__c": "false",
   "Folder_Name_": "Google Drive Notes and Attachments",
   "Parent_Folder_": "1oV_wWX-19ut"
}

在转换消息中使用以下表达式

%dw 2.0
output application/json
---
payload map (Sample, indexOfSamples) ->{
    "name": Sample.Name,
    "parentId": Sample.Parent_Folder
    
}

但是它现在可以工作了。我该如何实现?

1 个答案:

答案 0 :(得分:0)

如何直接访问必填字段?

%dw 2.0
output application/json
---
{
     "name": payload.Name,
    "parentId": payload.Parent_Folder_
    
}