我从magento-connctor get-product操作获得此响应:
{"product_id":"33","sku":"TEST","set":"18","type":"bundle","categories":["2","4","5","16","17","222"],"website["1","3","5","16"],"created_at":null,"updated_at":null,"type_id":null,"name":"test","description":null,"short_description":"test description","weight":null,"status":null,"url_key":null,"url_path":null,"visibility":null,"category_ids":null,"website_ids":null,"has_options":null,"gift_message_available":null,"price":null,"special_price":null,"special_from_date":null,"special_to_date":null,"tax_class_id":null,"tier_price":null,"meta_title":null,"meta_keyword":null,"meta_description":null,"custom_design":null,"custom_layout_update":null,"options_container":null,"additional_attributes":[{"key":"highlights","value":"testing Highlights"},{"key":"test_details","value":null},{"key":"frequently_asked_questions","value":"test_faq"}],"enable_googlecheckout":null}
如何按属性过滤并从有效负载中删除一些数据?
答案 0 :(得分:1)
您可以使用 Dataweave (Anypoint Studio中的转换消息组件),查看文档:
https://docs.mulesoft.com/mule-user-guide/v/3.7/using-dataweave-in-studio
包含您的数据的示例脚本:
%dw 1.0
%output application/json
---
{
product_id: payload.product_id,
sku: payload.sku,
set: payload.set,
type: payload.type,
categories: payload.categories map ((category , indexOfCategory) -> category),
website: payload.website map ((website , indexOfWebsite) -> website),
created_at: payload.created_at
}