Hi, What I remember of STON is that it simply puts out the entire tree. So it might include things you don’t want (like thisContext), and also does not handle loops well. But that is from memory, I might be wrong there.
For serialisation you could also look into the Magritte serialisation. It has several extenstions, among them one to output them in the JSon format. Disadvantage is that you have to describe your objects, but this is also helps you only send into the world the things you want. Regards, Diego > On 16 Jul 2017, at 21:00, Siemen Baader <[email protected]> wrote: > > Hi all, > > I’m trying to transpile the STON class to JavaScript with PharoJS to use it > in a client side web application. The goal is it to retrieve object(graphs) > from the server and deserialize them in the frontend via xhr. > > But PharoJS doesn't support thisContext, I think that's a limitation of the > JavaScript VM. PharoJS raises "PjJavascriptTranspilationError - thisContext > not supported. Found in Collection >> #toBraceStack:". I tried to add the > <pharoJsSkip> pragma to the method in the hope that it will not be needed for > my uses, but no luck. > > Is the use of thisContext needed in STON, can I avoid it? I had hoped to use > STON because it is simple and well documented and unlike JSON handles object > graphs and classes. > > What are my options? > > Alternatively, what else could I use to serialize objects? I'm already using > Voyage & Mongo on the backend which deal with JSON internally, and I think > Moose also has a serialization component. Using a JS library in the frontend > is also an option if there is a Pharo implementation for its format as well. > > Thanks, > Siemen
