Squeak
  QotD    "To be or not to be" – Shakespeare
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Retrieve a Json object
Last updated at 5:46 pm UTC on 27 August 2017
 jsonObjURL := 'https://api.github.com/repos/squeak-smalltalk/squeak.org/languages'.
 (Json readFrom: (WebClient httpGet: jsonObjURL) content utf8ToSqueak readStream) inspect

a JsonObject('CSS'->72599 'HTML'->19642 'JavaScript'->2738 'Ruby'->1827 'TeX'->147233 )



Note that
 (WebClient httpGet: jsonObjURL) content
gives back an instance of ByteString which needs to converted to a Squeak String with the method #utf8ToSqueak.


Note that in Pharo this would be something like
 STON fromString: 'https://api.github.com/repos/squeak-smalltalk/squeak.org/languages' asZnUrl retrieveContents