In terms of "dreams of the future", here is another observation I often made when using JSON (still "by the way" only):

I often found myself writing a tiny converter that converts snake_cased JSON keys into Smalltalkish camelCased keys and the other way around, just because it would be ugly to use underscore selectors in Squeak:


updates := self getUpdates: '/posts'.

updates do: [:update |

    posts at: update post_id put: update post_text]. ":-("


I wonder whether this could be a relevant part of the JSON package as well? Just asking this here because it might hypothetically help us to gain a better understanding of the right shape and scope of this package ... :-)


Best,

Christoph


Von: Thiede, Christoph
Gesendet: Dienstag, 6. Juli 2021 17:29:41
An: squeak-dev
Betreff: AW: [squeak-dev] JSON into Trunk? =)
 

Thus, it makes sense to move (1) to Trunk, deprecate (3), and finally take a look at how to benefit from (2).


+1
Maybe keep the public selectors on WebUtils and forward them to the "new" JSON protocol for compatibility reasons?

My comments on STON were not meant as an objection, just as a "related idea", so please keep going! :-)
(Another related idea is to build a YAML converter analogously for JSON. If we did this, I wonder they would belong in the same package and if yes, whether this package would still be named JSON. But that's still all dreams of the future ... :D)

Best,
Christoph


Von: Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel
Gesendet: Dienstag, 6. Juli 2021 16:23:55
An: squeak-dev
Betreff: Re: [squeak-dev] JSON into Trunk? =)
 
Hi Christoph,

good points. I would like to unify all three efforts of JSON parsing:
(1) http://www.squeaksource.com/JSON
(2) http://squeaksource.com/PostgresV3/JSON-ul.56.mcz
(3) WebUtils class >> #json{De,En}code:

I think that (1) is usually loaded in projects using JSON.
I think that (2) has valuable fixes and extensions for (1).
I think that (3) is hardly ever used. In Trunk, only in the WebClientServerTests.

Thus, it makes sense to move (1) to Trunk, deprecate (3), and finally take a look at how to benefit from (2).

Hmm... I wonder whether my perspective on and usage of JSON is correct. Yes, it is strongly connected to Web content. Yet, it is also a quite compact form to generate into a local file. Squeak's #storeString seems more bloated sometimes. Looking at WebUtils, most of my past scenarios would have worked using those, too. I suppose. Especially that recent one with TravisCI. :-)

Best,
Marcel

Am 06.07.2021 15:32:33 schrieb Thiede, Christoph <christoph.thiede@student.hpi.uni-potsdam.de>:

Hi Marcel, hi all,


I'm also a frequent user of JSON. I especially use it often for scripting tasks where it would be very helpful to have it in the Trunk by default.


However, I would also like to mention that we already have a small but working JSON implementation in WebUtils. See WebUtils class >> #json{De,En}code:. I'm not aware of all its limitations, but apparently, it does not have proper support for Unicode strings (\u...). Apart from that, it decodes to regular Dictionaries whereas JSON has JsonObjects with dynamic forwarding instead. Probably it would be a good idea to join these two concepts if we integrate JSON into the Trunk.


Also, consider Levente's fork of JSON, which we probably would like to merge as well: http://forum.world.st/I-d-like-to-contribute-to-the-JSON-project-tp5121353p5121357.html


---

As another whataboutistic comment, what is about STON? Currently, it resists as a kind of hidden fork on GitHub, and for some reason, smalltalkCI holds a hard copy of it. Could we argue to add it to the Trunk as well? 😊

Best,
Christoph

Von: Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von Fabio Niephaus <lists@fniephaus.com>
Gesendet: Dienstag, 6. Juli 2021 15:17:12
An: The general-purpose Squeak developers list
Betreff: Re: [squeak-dev] JSON into Trunk? =)
 
+1

On Tue, Jul 6, 2021 at 3:13 PM Tobias Pape <Das.Linux@gmx.de> wrote:
>
> YES
>
> > On 6. Jul 2021, at 15:06, Marcel Taeumel <marcel.taeumel@hpi.de> wrote:
> >
> > Hi all!
> >
> > I think it would be nice to have JSON as part of Squeak Trunk. This would make parsing the content of web requests easier. Recently, I got lucky to find the last-modified date in the HTTP header for the public TravisCI badge. But usually, one would have to query the official endpoint/API to then get XML or JSON content.
> >
> > http://www.squeaksource.com/JSON
> >
> > What do you think? The project is
> > + Self-contained
> > + Stable since 2016
> > + Not that big
> > o Adding the extension #jsonWriteOn: to the system
> >
> > Latest maintainers seem to be:
> > Hannes Hirzel (hjh, 2010)
> > Levente Uzonyi (ul, 2010)
> > Tony Garnock-Jones (tonyg, 2016)
> > Fabio Niephaus (FabN, 2016)
> >
> > Best,
> > Marcel
> >
>
>
>