Display contents extracted from a JSON tiddler as plain text?

I’m trying to use the handy new-ish JSON operators to extract some text from a nested JSON tiddler (called rt) whose contents are generated by a script and render it.

The actual JSON stuff is working fine. But for some reason I cannot find a way to display the text that both:

  1. retains newlines (\n) in the extracted text (I would be fine with it either treating them as wikitext-style breaks where two newlines are needed for a new paragraph, or treating them literally)
  2. doesn’t try to parse the extracted text as wikitext

Directly using a <<variable reference>> to the extracted content displays newlines correctly (as long as it’s a block of its own with blank lines on either side), but it tries to parse the result as wikitext.

The <$text> widget fixes the wikitext problem, but it always results in inline-mode content, so it doesn’t display the newlines correctly.

The <$wikify> widget seems, at first glance, like it ought to be able to do this; it has options for output type and MIME type. But the type parameter is effectively not honored here, I’m assuming because when I write <<content>>, the content that’s been parsed as plain text gets parsed again as wikitext. Setting the output parameter of $wikify to text does inhibit parsing of wikitext, but it gobbles the newlines!

This is the closest I’ve gotten, but it still results in wikitext parsing:

<$vars linksfor={{{ [{rt}jsonextract[Some Tiddler Name]] }}}>
<$wikify name="content" text={{{ [<linksfor>jsonextract[0]jsonget[text]] }}} type="text/plain" output="formattedtext">

	<<content>>

</$wikify>
</$vars>

I thought about trying to put a macro in somewhere to take advantage of parameters to $macrocall being wikified only once, but I can’t find a way to make this help because the content returned by the macro still ends up getting wikified again.

I’m out of ideas here – is there some widget or hack I’m not thinking of?

Have you tried the $codeblock widget?

Something along these lines:

<$vars linksfor={{{ [{rt}jsonextract[Some Tiddler Name]] }}}>
<$codeblock code={{{ [<linksfor>jsonextract[0]jsonget[text]] }}}>
</$vars>

Hmm, I didn’t try that one because I didn’t really want it to be formatted as code, but it does work; maybe I’ll just fuss around with the CSS a bit and restyle it.

Did you try changing the type on the tiddlers?, at least to see the result, then you can use this type using Typed blocks in WikiText