Giao diện
Ví dụ sử dụng - Get JSON Field
Ví dụ 1: Trích xuất token từ API response
Gọi API đăng nhập, trích xuất access_token từ response để dùng cho các request tiếp theo.
Cấu hình node Get JSON Field:
source: biến kết quả từ HTTP Request nodepath:data.access_tokendefaultValue:null
Response từ API login có cấu trúc { "data": { "access_token": "eyJ...", "expires_in": 3600 } }. Node trích xuất đúng field token mà không cần viết JavaScript.
Ví dụ 2: Đọc dữ liệu webhook Shopee
Webhook từ Shopee gửi payload phức tạp nhiều cấp, cần trích xuất thông tin đơn hàng.
Cấu hình node Get JSON Field (order_sn):
source: biếnwebhookBodypath:data.order.order_sndefaultValue:"UNKNOWN"
Cấu hình node Get JSON Field (items):
source: biếnwebhookBodypath:data.order.itemsdefaultValue:[]
Webhook Shopee có cấu trúc nested sâu. Hai node Get JSON Field trích xuất mã đơn hàng và danh sách sản phẩm để xử lý. Default value [] cho items đảm bảo node Loop phía sau không lỗi khi mảng rỗng.
Ví dụ 3: Parse cấu hình từ JSON trong database
Đọc cấu hình SMTP từ field JSON settings lưu trong collection Config.
Cấu hình node Get JSON Field:
source: biếnconfigRecord.settingspath:smtp.hostparseJson:truedefaultValue:"localhost"
Field settings trong database lưu dưới dạng JSON string. Bật parseJson: true để tự động parse string thành object trước khi trích xuất path smtp.host.