Your #fromJSON: methods should be on the class not the instance side.
On 25 Feb 2019, at 21:52, Roelof Wobben <r.wobben@home.nl> wrote:
Hello,
I try to ask a api for some data and then display the data I want.
But when I do :
json := (NeoJSONReader fromString: (ZnEasy get: 'https://www.rijksmuseum.nl/api/nl/collection?key=14OGzuak&format=json&type=s... ') contents).
Paintings new fromJSON: json
I still see a message that Paintings do not understand new.
What did I do wrong here.
I will include a file-out of my code
Regards,
Roelof
<Paintings.st>
Thanks, How do I know the next time if I need to use a instance or a class method ? That was the trick. Roelof Op 25-2-2019 om 22:05 schreef Sven Van Caekenberghe:
json := (NeoJSONReader fromString: (ZnEasy get: 'https://www.rijksmuseum.nl/api/nl/collection?key=14OGzuak&format=json&type=s... ') contents).
Paintings new fromJSON: json
On 25 Feb 2019, at 22:30, Roelof Wobben <r.wobben@home.nl> wrote:
Thanks,
How do I know the next time if I need to use a instance or a class method ?
Instance creation happens on the class side, when your are on the instance side, your already have an instance (self) that was already created [this is by definition/design], so there is no point in creating a new instance, unless you want to make a copy or convert to something else.
That was the trick.
Roelof
Op 25-2-2019 om 22:05 schreef Sven Van Caekenberghe:
json := (NeoJSONReader fromString: (ZnEasy get: 'https://www.rijksmuseum.nl/api/nl/collection?key=14OGzuak&format=json&type=s... ') contents).
Paintings new fromJSON: json
participants (2)
-
Roelof Wobben -
Sven Van Caekenberghe