Getting JSON parameter needs to be valid JSON while using {{ $fromAI('JSON', ``, 'json') }}

in the below screenshot when i use {{ $fromAI(‘JSON’, ``, ‘json’) }} ai loading data but not working.

when i use that manually its working. give me solution to use json parm from ai

please give me a solution

  • You’re passing an empty string (``) as the AI response, so there’s nothing for n8n to parse.
  • The function will return null or an error because it has no data to extract.

try something like this - m{{ $fromAI(‘JSON’, $json[“ai_response”], ‘json’) }}