Visual Body Editor
Configure complex JSON body injection visually with drag-and-drop. No template syntax required.What is the Visual Body Editor?
The Visual Body Editor is a drag-and-drop interface for injecting values (like secrets) into specific locations in your JSON request body. Traditional way (manual templates):- Capture or paste an example JSON payload
- Drag injection rules onto specific fields
- KnoxCall builds the template automatically
When to Use This Feature
Use Visual Editor When:
- ✅ You have complex nested JSON structures
- ✅ You need to inject multiple secrets at different depths
- ✅ You want to see the exact structure visually
- ✅ You’re not comfortable with JSON template syntax
- ✅ You need to inject values into deeply nested objects
Use Manual Template When:
- ⚠️ Simple flat JSON payloads (1-2 fields)
- ⚠️ You prefer writing JSON directly
- ⚠️ Dynamic payloads that vary by request
How It Works
Step-by-Step Guide
Step 1: Open Route Configuration
- Navigate to Routes
- Click your route
- Go to Configuration tab (or Method Configs for method-specific body)
- Scroll to Body Injection section
Step 2: Capture or Paste Payload
You have two options:Option A: Capture Live Request (Recommended)
Best for APIs you can actually call.- Click Capture Payload
- Choose Live Request
- Copy the unique capture URL
- Send a POST request to that URL with example payload:
- KnoxCall automatically captures the structure
Option B: Paste JSON (Faster)
Best when you already have example JSON.- Click Capture Payload
- Choose Paste JSON
- Paste your example JSON:
- Click Submit Payload
Tip: Use realistic example data. The structure you provide becomes your template. Any fields you add later won’t have drop zones unless you recapture.
Step 3: Create Injection Rules
Injection rules are key-value pairs you’ll drag onto your JSON structure.- Click + Add Injection Rule
- Enter Key (field name to inject):
- Enter Value (what to inject):
- Or click 🔑 Secrets button to pick from dropdown
- Click Add Rule
| Key | Value | Purpose |
|---|---|---|
| api_key | {{secret:stripe_key}} | Stripe API key |
| auth_token | {{secret:user_token}} | User auth token |
| webhook_secret | {{secret:webhook_secret}} | Webhook signing |
| customer_id | {{vars.customer_id}} | From query param |
Step 4: Drag Rules onto JSON Structure
Now the fun part - visually place your injection rules. The interface shows:- Top section: List of injection rules (draggable)
- Bottom section: Your JSON payload structure (drop zones)
- Click and hold an injection rule from the top
- Drag it over the JSON structure below
- Drop it onto a specific field
- Blue line above = Drop before this field
- Blue line below = Drop after this field
- “DROP AS CHILD →” badge = Drop inside nested object
Step 5: Assign Nested Fields
For nested objects, you can inject at any depth: Example structure:notifications with “DROP AS CHILD”:
user.profile.settings.notifications.token
Step 6: Save Route
Click Save or Update Route Your body injection template is now configured!Understanding Injection Rules
Rule Components
Each injection rule has three properties: 1. Key (Required)- The field name to inject
- Example:
api_key,token,customer_id - Shows in the final JSON
- The value to inject
- Can be:
- Secret:
{{secret:stripe_key}} - Variable:
{{vars.user_id}} - Static:
"production" - Mixed:
Bearer {{secret:token}}
- Secret:
- Where in the JSON to inject
- Example:
payment.details.api_key - Automatically set when you drop the rule
- Can be empty if not assigned yet
Rule States
Unassigned (gray):payment.api_key path
Managing Rules
Reorder Rules (Drag Within JSON)
To move a rule to a different location:- Find the green ✓ INJECTED box in your JSON structure
- Drag it to a new location
- Drop on a different field
Remove Rule Assignment
To unassign a rule (without deleting it):- Click Remove button on the green ✓ INJECTED box
- Rule moves back to unassigned list (top section)
- Can be reassigned later by dragging again
Delete Rule Completely
To permanently delete a rule:- Click Remove button in the Injection Rules list (top section)
- Rule is deleted entirely
- If it was assigned, it’s removed from JSON structure too
Edit Existing Rule
Currently, rules cannot be edited after creation. To change:- Delete the existing rule
- Create a new rule with updated values
- Drag onto the same location
Example Use Cases
Use Case 1: Payment API with Nested Secrets
Goal: Inject Stripe key and webhook secret at different depths Example payload:| Key | Value | Path |
|---|---|---|
| api_key | {{secret:stripe_prod_key}} | payment.api_key |
| secret | {{secret:webhook_secret}} | webhook.secret |
Use Case 2: User Profile with Dynamic Variables
Goal: Inject user-specific tokens from query params Example payload:| Key | Value | Path |
|---|---|---|
| token | {{secret:api_token}} | user.auth.token |
| id | {{vars.user_id}} | user.id |
Use Case 3: Multi-Service Request
Goal: Call multiple services with different API keys in one payload Example payload:| Key | Value | Path |
|---|---|---|
| key | {{secret:stripe_key}} | stripe.key |
| key | {{secret:sendgrid_key}} | sendgrid.key |
| key | {{secret:twilio_key}} | twilio.key |
Editing Payload Structure
Recapture Payload
If your API payload structure changed:- Click Recapture button (next to payload structure)
- Send new request or paste updated JSON
- ⚠️ Warning: Existing rule assignments are lost
- Drag rules onto new structure again
Edit Payload Manually
For small tweaks:- Click Edit button
- Modify JSON structure directly
- Save
- Reassign rules if paths changed
Delete Payload Structure
To start over:- Click Delete button
- Confirm deletion
- All rule assignments cleared
- Can capture new payload structure
Advanced Features
Nested Object Injection
Drop rules into nested objects: Drag rule to right side of parent:Multiple Rules on Same Level
You can inject multiple fields at the same nesting level:payment.
Parent Path Requirements
The editor shows warnings for nested injections:Combining with Method Configs
You can use visual body editor per HTTP method: GET method: No body injection (GET has no body) POST method:- Payload: User creation structure
- Inject:
write_api_key,create_token
- Payload: User update structure
- Inject:
update_api_key,version_token
- Payload: Deletion confirmation
- Inject:
delete_token,admin_key
- Payload structure
- Injection rules
- Drop zone assignments
Troubleshooting
Issue: “Drag not working”
Causes:- Browser compatibility (use Chrome/Edge/Firefox)
- JavaScript disabled
- Conflicting browser extensions
- Try different browser
- Disable ad blockers temporarily
- Clear browser cache
Issue: “Drop indicator not showing”
Symptoms: Can’t see blue line or “DROP AS CHILD” badge Causes:- Not dragging an actual rule
- Dragging too fast
- CSS rendering issue
- Drag slowly and hover over fields
- Wait for indicator to appear
- Refresh page
Issue: “Rule not injected in requests”
Symptoms: Backend doesn’t receive injected field Debug:- Check rule is assigned (shows green with path)
- Check rule appears in JSON structure (green ✓ INJECTED box)
- Test route with Route Tester
- View request details in logs
- Verify secret exists if using
{{secret:name}}
Issue: “Parent key must exist” warning
Symptoms: Injecting into nested path likeuser.profile.token
Cause: Incoming requests don’t always have user.profile object
Fix:
- Ensure incoming requests include parent object:
- Or inject at root level instead of nested
- Or use method configs to define base structure
Issue: “Payload structure deleted my rules”
Symptoms: Recaptured payload and rules disappeared Actually: Rules still exist but assignments cleared Fix:- Rules are in top Injection Rules list
- Drag them onto new payload structure
- Save route
- To prevent: Don’t recapture unnecessarily
Best Practices
1. Use Realistic Example Payloads
✅ Good:2. Name Rules Descriptively
✅ Good:3. Test After Configuration
Always test with Route Tester:- Configure visual body editor
- Click Test Route
- Send test request
- Verify injected fields in Request Details section
- Check backend received correct values
4. Document Your Structure
In route description, note the payload structure:5. Use Variables for Dynamic Values
Don’t hardcode dynamic data: ❌ Bad:6. Organize Rules by Service
Group related rules:Limitations
Arrays Not Fully Supported
The editor shows arrays but doesn’t let you inject into array items: Structure:items level
Cannot inject: Specific array item like items[0].name
Workaround: Use manual template editing for array injection.
Max Nesting Depth: 10 Levels
Payloads deeper than 10 levels may not render properly:No Conditional Injection
Rules are always injected. Cannot do:- “Only inject if query param exists”
- “Inject different value based on environment”
Large Payloads (>1000 fields)
Very large JSON structures may slow down the editor. Workaround: Break into multiple routes or use manual template editing.Related Features
- Manual Body Templates: Edit JSON directly without visual editor
- Method Configs: Different body per HTTP method
- Secrets: Encrypted credentials for injection
- Variables: Inject query parameters with
{{vars.name}}
Next Steps
Method Configs
Different body per HTTP method
Test Routes
Test your body injection
Secrets
Create secrets for injection
Advanced Config
Headers, transformations, and more
📊 Statistics
- Level: intermediate
- Time: 15 minutes
🏷️ Tags
body-injection, visual-editor, drag-drop, json, configuration