Hi, I was playing with GitHub Gist API and I have queried the following Gist: https://gist.github.com/mbostock/5503544 <https://gist.github.com/mbostock/5503544> I was interested how the PNG image is returned: https://gist.github.com/mbostock/5503544#file-thumbnail-png <https://gist.github.com/mbostock/5503544#file-thumbnail-png>
I can obtain the whole Gist executing: STONJSON fromString: (ZnClient new url: 'https://api.github.com/gists/5503544'; accept: 'application/vnd.github.v3+json'; get). I can get PNG contents executing: pngData := (ZnEasy get: ((((STONJSON fromString: (ZnClient new url: 'https://api.github.com/gists/5503544'; accept: 'application/vnd.github.v3+json'; get)) at: 'files') at: 'thumbnail.png') at: 'raw_url')) contents. PNGReadWriter formFromStream: rawPng readStream. But the PNG image is part of the Gist query and can be retrieved by: pngContent := ((((STONJSON fromString: (ZnClient new url: 'https://api.github.com/gists/5503544'; accept: 'application/vnd.github.v3+json'; get)) at: 'files') at: 'thumbnail.png') at: 'content'). "As pngContent is a WideString, I cannot use:" PNGReadWriter formFromStream: pngContent readStream. How can I read the PNG image from the pngContent? Any idea? And the reverse question: How can I send the PNG bytes using JSON format? Thanks! Juraj