[Cuis-dev] [IMPROV] Add convenience method to read JSON strings

Gerald Klix cuis.01 at klix.ch
Thu Aug 12 00:11:32 PDT 2021


Good idea.

May I suggest to to implement it this way:
--- snip ---
Json readFrom: aString readStream
--- snap ---
(See SequenceableCollection>>#readStream, inherited by String))

If your JSON documents are bigger, it might be more efficient
to convert the HTTPSocket to a SocketStream and read directly from
it, but I do not know whether this is possible without much effort.


Just my €0.02,

Gerald



On 8/12/21 8:49 AM, Nicola Mingotti via Cuis-dev wrote:
> Hi guys and Juan,
> 
> I frequently need to parse JSON data. It comes mostly from the web and 
> it is 100% of
> the time a string. I did not find something equivalent so I made my own.
> 
> I am using it frequently, i think it is useful, if something equivalent 
> does not exist
> I would add it to the Json class.
> 
> ----- example ----
> Feature require: 'JSON'.
> 
> Json readFromString: '{"a": "alpha", "b": [1,2,3]}'.
> ----------------------
> 
> attached fileout
> 
> bye
> Nicola
> 
> 
> 
> 
> 


More information about the Cuis-dev mailing list