STON
Last updated at 1:09 pm UTC on 19 February 2018
https://github.com/svenvc/ston
- STON - Smalltalk Object Notation - A lightweight text-based, human-readable data interchange format for class-based object-oriented languages like Smalltalk.
- STON follows ideas of JSON (Javascript Object Notation).
- The current STON implementation is backwards compatible with standard JSON.
- It is integrated in Pharo 5 and available for Squeak.
Smalltalk Object Notation (STON) documentation
Sven Van Caekenberghe
<sven@beta9.be> Tue, Apr 24, 2012 at 7:35 PM
Reply-To: Pharo-project@lists.gforge.inria.fr
To: Pharo-project@lists.gforge.inria.fr
Reply | Reply to all | Forward | Print | Delete | Show original
On 24 Apr 2012, at 19:22, Dale Henrichs wrote:
> Sven,
>
> I looked at your sample document in the pdf:
>
> TestDomainObject {
> #created : DateAndTime [ '2012-02-14T16:40:15+01:00' ],
> #modified : DateAndTime [ '2012-02-14T16:40:18+01:00' ],
> #integer : 39581,
> #float : 73.84789359463944,
> #description : 'This is a test',
> #color : #green,
> #tags : [
> #two,
> #beta,
> #medium
> ],
> #bytes : ByteArray [ 'afabfdf61d030f43eb67960c0ae9f39f' ],
> #boolean : false
> }
>
> And this is very readable (to me)... not as many '[]' as I inferred from reading the tests:).
>
> I take back my YAML comparison ... this has the nice flavor of Smalltalk ...
>
> Dale
Thanks!
The main 'hack' is to extend JSON's list/array [] and map/dictionary {} with a very simple way to instanciate any class, by preceding them with a class name (or alias) and giving the control to instanciate to the class or instance. Furthermore, for Array and Dictionary these are optional. For the concrete representations chosen for say DateAndTime or ByteArray, human readability was the deciding factor. But any of these could be changed without hurting the concept.
Note that there are also references and implicit object counting and graph tracing with a defined visit order. In a discussion with Mariano I kind of decided to no longer treat Strings as shareable/reference-able objects. This is not yet reflected in the document but it is in the code.
Sven
STON for Squeak
to check
STON to read into Squeak, check out these three packages and report here if they are OK:
http://www.squeaksource.com/Oceanside/Ston-Core-SvenVanCaekenberghe.36.mcz
http://www.squeaksource.com/Oceanside/STON-Text%20support-TheIntegrator.2.mcz
http://www.squeaksource.com/Oceanside/Ston-Tests-SvenVanCaekenberghe.34.mcz
About STONS efficiency at storing nested objects
Sven Van Caekenberghe<sven@stfx.eu> Wed, Nov 2, 2016 at 6:21 PM
Reply-To: Any question about pharo is welcome <pharo-users@lists.pharo.org>
To: Any question about pharo is welcome <pharo-users@lists.pharo.org>
Basically, STON walks the graph noting each object it sees. When it encounters the same object again, it outputs a reference. Object equality is of course #==
References are integers, indexes into the list of objects seen, ordered by walking depth first.
See also
SIXX