On Sat, 16 Mar 2019 at 04:21, Roelof Wobben <r.wob...@home.nl> wrote:
> Hello, > > I try to parse a json that differs some times > > after parsing with neojson I see something like this > > "an Array(a Dictionary('height'->3640 'name'->'z0' 'tiles'->an Array(a > Dictionary('url'->'http://lh3...TItQ4wwXk80sCHkqSS3JgTgmehYP-OItkO4hMwqH1agr-LfNRnxUCRSJKc_VQ=s0' > 'x'->0 'y'->0 )) 'width'->404 ))" > > > is there a way I can filter out a dictonary where the name is equal to z4 > > Because of cultural differences, I'm not sure by "filter out" whether you mean include or exclude but when filtering any collection type, #select: #detect and #reject: are you main go to messages. If you inspect your dictionary and on the meta tab filter for ...*select*... you'll find #associationsSelect: which works like this... d := Dictionary newFromPairs: #( 1 2 3 4 5 6 ). d associationsSelect: [ :asn | (asn key = 1) and: (asn value = 2) ] d inspect. ==> Dictionary [1 item] (1->2 ) I notice there is not a similar #associationsReject: so if needed you could add your own considering... d := Dictionary newFromPairs: #( 1 2 3 4 5 6 ). d associations select: [ :asn | (asn key = 1) and: (asn value = 2) ] d inspect. ==> Array [1 item] (1->2) d := Dictionary newFromPairs: #( 1 2 3 4 5 6 ). d associations reject: [ :asn | (asn key = 1) and: (asn value = 2) ] d inspect. ==> Array [2 items] (5->6 3->4) cheers -ben