TiddlyWiki / TiddlyWiki5

A self-contained JavaScript wiki for the browser, Node.js, AWS Lambda etc.
https://tiddlywiki.com/
Other
7.97k stars 1.18k forks source link

Explore using JSON Pointers to reference data within data tiddlers #411

Closed Jermolene closed 1 year ago

Jermolene commented 10 years ago

The existing RFC 6901 provides a standard way to encode pointers that de-reference items within a JSON object:

http://tools.ietf.org/html/rfc6901

The format is pretty simple (apart from the inevitable encoding gotchas). Pointers are a list of tokens each preceded by /. The remainder of each token gives the property name or array index of the ancestor items.

For example, given this JSON:

{
"one":"first",
"two":[
"second",{"third":"fourth"}
]
}

The following references resolve as follows:

/one --> first
/two/0 --> "second"
/two/1/third --> "fourth"

We could adopt this syntax in a more or less backwards compatible way.

pmario commented 10 years ago

what do you get with

/  --> ?
/two/1 --> ?
Jermolene commented 10 years ago

I'm not sure if I'm reading the spec right, but it looks like / would be treated the same as an empty string, and refer to the entire JSON object.

/two/1 would give {"third":"fourth"} (ie it would return an object, not a string).

pmario commented 10 years ago

Just did crossread the spec. .. I think it would be nice to reference data-tiddlers that way. so +1 :)

pmario commented 10 years ago

@Skeeve may be interested?

pmario commented 2 years ago

Broken link it OP is: https://datatracker.ietf.org/doc/html/rfc6901 now

pmario commented 1 year ago

@Jermolene ... Since we have the new JSON-operatos in v5.3.0 imo this issue is obsolete and should be closed

Jermolene commented 1 year ago

Thanks @pmario