Passing 'truncate' to a JSON file

With an index.json with the code shown below, how do I pass truncate to the .Params.excerpt?

{{- $blog := slice -}}

 {{ $post := where site.RegularPages "Type" "post" }}
{{- range $post -}}
  {{- $item := dict
    "Title" .Title
    "PublishDateFormatted" (.PublishDate.Format "2006-01-02")
    "RelPermalink" .RelPermalink
    "PlainContent" .Params.excerpt -}}

  {{- $blog = $blog | append $item -}}
{{- end -}}

{{- $object := dict "blog" $blog -}}

{{- if (eq site.Params.search_minify true) -}}
  {{- $object | jsonify -}}
{{- else -}}
  {{- $jsonifyOptions := dict "indent" "  " -}}
  {{- $object | jsonify $jsonifyOptions -}}
{{- end -}}
"PlainContent" (truncate .Params.excerpt)

That returns an error. Perhaps I should have been more clear. I want to truncate to a number of words (like 250).

Perhaps you should provide a complete example.

And the error messages.

The shared code is the complete code.

error calling truncate: truncate requires a length and a string

"PlainContent" (.Params.excerpt | truncate 250 )