TiddlyWiki5/editions/tw5.com/tiddlers/jsonvariable Operator (Exam...

42 lines
1.6 KiB
Plaintext

created: 20240506132850677
modified: 20240506151551620
tags: [[Operator Examples]] [[jsonvariable Operator]]
title: jsonvariable Operator (Examples)
type: text/vnd.tiddlywiki
The following example shows the "internal" structure of the `fn.test` function defined in <<.olink jsonvariable>> operator
<<.example 1 """\procedure testProc() [[aa aa]] bb
\function fn.test(splitChar:" " not-used) [enlist<testProc>format:titlelist[]]
<pre><code><$text text={{{[[fn.test]jsonvariable[]]}}}/></code></pre>
""">>
The following example shows the same structure ''pretty printed'' using the <<.olink format>> filter operator
<<.example 2 """\procedure testProc() [[aa aa]] bb
\function fn.test(splitChar:" " not-used) [enlist<testProc>format:titlelist[]]
\function tab() [charcode[9]]
<pre><code><$text text={{{[[fn.test]jsonvariable[]format:json<tab>]}}}/></code></pre>
""">>
The following example extracts the ''function definition'' using the <<.olink jsonextract>> filter operator
<<.example 3 """\procedure testProc() [[aa aa]] bb
\function fn.test(splitChar:" " not-used) [enlist<testProc>format:titlelist[]]
<pre><code><$text text={{{[[fn.test]jsonvariable[]jsonextract[srcVariable],[value]]}}}/></code></pre>
""">>
The following example extracts the `srcVariables.params` without pretty printing using <<.olink jsonextract>>
<<.example 4 """\procedure testProc() [[aa aa]] bb
\function fn.test(splitChar:" " not-used) [enlist<testProc>format:titlelist[]]
\function tab() [charcode[9]]
<pre><code><$text text={{{[[fn.test]jsonvariable[]jsonextract[srcVariable],[params]format:json<tab>]}}}/></code></pre>""">>