mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-09-28 07:08:20 +00:00
WIP
This commit is contained in:
parent
1d4418a777
commit
096b30f43b
87
editions/tw5.com/tiddlers/JSON in TiddlyWiki.tid
Normal file
87
editions/tw5.com/tiddlers/JSON in TiddlyWiki.tid
Normal file
@ -0,0 +1,87 @@
|
||||
created: 20220406163813574
|
||||
modified: 20220408112300157
|
||||
tags: Features
|
||||
title: JSON in TiddlyWiki
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
!! Introduction
|
||||
|
||||
JSON (~JavaScript Object Notation) is a standardised text representation for data structures that is widely used for the storage and transfer of data.
|
||||
|
||||
JSON is used in several different contexts in TiddlyWiki. For example:
|
||||
|
||||
* Tiddlers are represented as JSON data within TiddlyWiki HTML files
|
||||
* Groups of tiddlers can be [[exported|How to export tiddlers]] and [[imported|Importing Tiddlers]] as JSON files
|
||||
* Plugin tiddlers store their constituent shadow tiddlers as JSON data
|
||||
* The client-server configuration uses JSON messages to communicate between the client and the server
|
||||
* Arbitrary JSON data within DataTiddlers can be processed and manipulated using a set of filter operators and action widgets
|
||||
|
||||
!! About JSON
|
||||
|
||||
The technical description of JSON at the official website https://json.org/ is terse. Here we summarise the main features.
|
||||
|
||||
JSON supports two basic data structures:
|
||||
|
||||
''Arrays'' are lists of items. The items are identified by their numeric index (starting at zero)
|
||||
|
||||
An example of an array is:
|
||||
|
||||
```
|
||||
["one","two","three\"four"]
|
||||
```
|
||||
|
||||
Note the following features of arrays:
|
||||
|
||||
* The array is signified by square brackets surrounding the list of items
|
||||
* Each item is a string in double quotes. Double quotes can be included within the strings by preceding them with a backslash (`\`)
|
||||
* The items are separated by commas
|
||||
|
||||
''Objects'' are collections of name/value pairs. Each item is a value that is identified by a unique name
|
||||
|
||||
An example of an object is:
|
||||
|
||||
```
|
||||
{
|
||||
"first": "This is the first value",
|
||||
"second": "This is the second value",
|
||||
"third": "This is the third value"
|
||||
}
|
||||
```
|
||||
|
||||
Note the following features of objects:
|
||||
|
||||
* The object is signified by curly braces surrounding the list of name/value pairs
|
||||
* Each name/value pair consists of the name in double quotes, a colon, and then the value
|
||||
* The name/value pairs are separated by commas
|
||||
|
||||
The examples above all show string values. JSON actually supports several different types of value. Any of these types can be used as a value:
|
||||
|
||||
* String values, as shown above
|
||||
* Numeric values, represented as signed decimals such as `1`, `3.14`. Exponential notation can also be used e.g. `-1E10`
|
||||
* Boolean values, represented by the keywords `true` and `false`
|
||||
* The special value `null`, which is often used to represent data that is missing or incomplete
|
||||
* Objects and arrays are also values, allowing complex nested structures to be represented
|
||||
|
||||
!! Examples
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
!! Working with Data Tiddlers
|
||||
|
||||
* Reading data from JSON tiddlers
|
||||
* Constructing JSON tiddlers
|
||||
* Modifying JSON tiddlers
|
||||
|
||||
[[jsonstringify Operator]]
|
||||
|
||||
|
||||
[[jsontiddler Macro]]
|
||||
[[jsontiddlers Macro]]
|
||||
|
||||
JSONTiddlerWidget
|
||||
|
||||
[[JSONTiddlers]]
|
||||
|
||||
[[TiddlyWeb JSON tiddler format]]
|
Loading…
Reference in New Issue
Block a user