TLDR: TradingView sends a webhook with the application/json content type only when the complete alert message is valid JSON. If it is not valid JSON, TradingView sends text/plain. A receiver expecting JSON may reject the request or fail to create an order. Common problems include missing double quotes, trailing commas, unescaped characters, missing braces, placeholders producing unexpected text, and field names the destination service does not support. Validate the final rendered message and test with paper trading. Ultra Mega Trader avoids JSON order messages entirely by working with the broker connection inside TradingView.
Stop Executing Trades By Hand.
UMT Automator turns your TradingView or NinjaTrader strategy into automatic, hands-free execution — no code, no webhooks, no missed signals. Prefer a ready-made edge? Browse UMT's tested Strategies & Indicators built for both platforms.
Free 7-day trial on the Automator · No credit card required
Why TradingView Says Your Webhook JSON Is Invalid
JSON has strict syntax. A message that looks readable can still be invalid. TradingView determines the webhook content type from the final alert message:
- Valid JSON:
application/json - Anything else:
text/plain
If your middleware accepts only JSON, the content-type change can cause a 400, 403, parsing error, or silent rejection.
Valid and Invalid TradingView JSON Examples
Valid JSON
{
"action": "buy",
"symbol": "MNQ",
"quantity": 1
}
Invalid: Missing Quotes Around Keys
{
action: "buy",
symbol: "MNQ"
}
Invalid: Trailing Comma
{
"action": "buy",
"symbol": "MNQ",
}
Invalid: Single Quotes
{
'action': 'buy'
}
Standard JSON requires double quotes around property names and string values.
Ten Common TradingView JSON Problems
- Missing double quotes: Keys and string values need double quotes.
- Trailing comma: Remove the comma after the final property.
- Unbalanced braces: Every opening brace or bracket needs a closing match.
- Unescaped quotes: Quotes inside a string must be escaped.
- Placeholder becomes text: A numeric placeholder may resolve to an empty or unexpected value.
- Wrong data type: The service may expect a number but receive a quoted string.
- Unsupported field name: Valid JSON can still be invalid for the receiving service.
- Line breaks or control characters: Unescaped characters can break a string.
- Duplicate or conflicting fields: The parser may use the wrong value or reject the message.
- Copied smart quotes: Curly quotation marks are not JSON delimiters.
TradingView Placeholders Can Change the Final JSON
Placeholders are replaced when the alert triggers. The template may validate before replacement while the final message does not.
For example:
{
"price": {{close}},
"symbol": "{{ticker}}"
}
This can be valid if {{close}} becomes a plain number. A different placeholder or missing value may produce invalid JSON. The destination may also require a full exchange-qualified symbol rather than the value supplied by {{ticker}}.
Always compare the actual alert message in the Alert log or receiver with the template.
Valid JSON Can Still Produce No Trade
JSON syntax is only the first layer. The receiving platform may require exact commands such as:
- A supported action value.
- A broker-recognized symbol.
- A positive quantity in the correct units.
- An account or route identifier.
- A valid authentication token.
- An allowed order type and price increment.
A message can pass a JSON validator and still fail the service's schema or the broker's order rules.
How to Test TradingView Webhook JSON Safely
- Remove all live broker credentials from the test message.
- Paste the final example into a reputable local or trusted JSON validator.
- Send a paper-trading alert to a secure request inspector.
- Confirm the content type is
application/json. - Compare the received body with the destination service's required schema.
- Test the service using its simulator or paper account.
- Verify one signal creates exactly one intended broker order.
Do Not Put Passwords in JSON
TradingView warns users not to include login credentials or passwords in webhook bodies. Treat an account-specific webhook URL, token, and alert message as sensitive information.
Redact secrets before sharing screenshots, support tickets, forum posts, or JSON examples.
Automate TradingView Without JSON Messages
Ultra Mega Trader Automator does not require JSON alert commands. It works in the browser with TradingView strategy activity and the broker connection opened inside TradingView.
This removes JSON syntax, content-type selection, webhook parsing, and external message-schema mapping from the workflow. Traders still need the correct strategy, symbol, quantity, order settings, broker connection, open browser, and stable internet.
See How to Automate TradingView Without Webhooks, API Keys, or Code.
Want to stop maintaining JSON trade commands? Start a free seven-day UMT trial by contacting support@ultramegatrader.com. Validate the workflow in paper trading.
TradingView Invalid JSON FAQ
Why is TradingView sending text/plain instead of application/json?
TradingView sends application/json only when the alert message is valid JSON. Otherwise it uses text/plain.
Can I use single quotes in TradingView webhook JSON?
Not for standard JSON property names and string values. Use straight double quotes.
Why does valid JSON still get rejected?
The message may fail the receiving service's schema, authentication, symbol, quantity, or order rules even though the syntax is valid.
Does UMT use JSON alerts?
No. UMT's browser-based workflow does not require webhook JSON messages.
Sources
Educational content only. Never publish webhook secrets or broker credentials. Automated trading involves risk of loss, and valid JSON does not guarantee broker acceptance, execution, or profitability.