Json Index separation

For a number of reasons I won’t go into here, LLM suggestions for TiddlyWiki coding are consistently bad.

In this particular case, the suggested $transclude widget usage:

<$transclude tiddler="..." index="..."/>

can only access top-level "key":"value" JSON data, like this:

{
    "a": "one",
    "b": "",
    "c": "three"
}

If a JSON tiddler contains nested objects (e.g., “d” in your example JSON), those deeper level JSON data values cannot be accessed by the $transclude widget. Note that if a JSON tiddler actually contained a top-level index named “d.e”, the $transclude syntax would be able to retrieve it, since “d.e” is just an index key that happens to contain a “.” as part of the key name.

Still… it might be a nice TWCore enhancement if the syntax suggested by Gemini actually could produce results for nested JSON objects. What would be needed is a “fallback” approach:

  • The $transclude widget processing would first attempt to find a top-level key with the specified “d.e” key name (as it currently does)
  • Then, if that doesn’t yield a result, the TWCore could split the “d.e” key name on the “.” and use each part to process the tiddler’s text content as if a [[tiddlername]get[text]jsonget[d],[e]] filter were being applied.

This might even be relatively easy to implement by simply calling on the existing jsonget filter code to perform the extended JSON processing. I have no idea if this approach would have any significant performance issues, but I think it’s worth considering.

@jeremyruston … what do you think?

-e