I am a new user and am having trouble accessing data in JSON tiddler “ConfigY” with type = “application/json”. I tried 8 different retrieval scenarios all contained in the $set widget that initializes jsondata. Some work and most do not. I am missing something obvious. I would greatly appreciate suggestions of what I am doing wrong for the scenarios that don’t work (#4,6,7,8).
Thank you,
-Dan
Here is ConfigY
{
"a": "Apple",
"b": "",
"c": "three",
"d": {
"e": "four",
"f": [
"five",
"six",
true,
false,
null
],
"g": {
"x": "max",
"y": "may",
"z": "maize"
}
}
}
Here are the results of the 8 scenarios:
- Accessing key=a of json tiddler with transclusion wikitext:
<$set name="jsondata" value={{ConfigY}}>
{{ConfigY##a}}
<$set>
Preview:
Apple
works showing JSON object is recognized
2. Contents of jsondata - triple curly bracket filter syntax:
<$set name="jsondata" value={{ConfigY}}>
{{{ [<jsondata>] }}}
<$set>
Preview:
{ "a": "Apple", "b": "", "c": "three", "d": { "e": "four", "f": [ "five", "six", true, false, null ], "g": { "x": "max", "y": "may", "z": "maize" } } }
Seems to work
- Contents of jsondata - variable syntax:
<$set name="jsondata" value={{ConfigY}}>
<<jsondata>>
<$set>
Preview:
{ "a": "Apple", "b": "", "c": "three", "d": { "e": "four", "f": [ "five", "six", true, false, null ], "g": { "x": "max", "y": "may", "z": "maize" } } }
Seems to work
4. Retrieve access key=a using wikitext variable syntax:
<$set name="jsondata" value={{ConfigY}}>
<<jsondata##a>>
<$set>
Does not work
5. Retrieve access key=a using view widget:
<$set name="jsondata" value={{ConfigY}}>
<$view tiddler="ConfigY" index=a />
<$set>
Preview:
Apple
Works
6. Retrieve access key=a with jsonget - filter syntax:
<$set name="jsondata" value={{ConfigY}}>
{{{ [<jsondata>jsonget[a]] }}}
<$set>
Preview shows nothing. Does not work
7. Try to get indices with jsonindexes using filter syntax:
<$set name="jsondata" value={{ConfigY}}>
{{{ [<jsondata>jsonindexes[]] }}}
<$set>
Preview is blank. Does not work
8. Try to extract with jsonextract using filter syntax:
<$set name="jsondata" value={{ConfigY}}>
{{{ [<jsondata>jsonextract[]] }}}
<$set>
Preview is blank. Does not work