In Mustache templating, I want to check if a particular key exists in json. How can I achieve this?
Mustache is for logic-less templating so you can't have this kind of condition in your code.
You'll need to somehow modify the JSON, either when you create it (if you have control over it), or after you receive it. For example, you could add an "isTraining" property to that particular JSON object:
{
"channelId": "training",
"maxResults": 99,
"searchRadius": 100,
"isTraining": true
}
And then you can use that in the Mustache template:
{{#isTraining}}
...
{{/isTraining}}