Re: NSMutableDictionary
Re: NSMutableDictionary
- Subject: Re: NSMutableDictionary
- From: jazzsalsa <email@hidden>
- Date: Sat, 06 Feb 2016 23:36:14 +0100
Thanks Hugi,
This really helps. I will give that I try. How do I add it now to the
database uisng the EOF? Add them to a NSDictionary with a loop and
store in the editing context?
Best regards, Bart
On Sat, 2016-02-06 at 22:21 +0000, Hugi Thordarson wrote:
> Before I help you with your dictionary stuff, I’d like to sincerely
> recommend that you don’t use generic data structures such as arrays
> as dictionaries to represent your data in code, if at all possible,
> and switch to using classes.
>
> If your data has a known structure, you can create a class graph in
> java and then use a JSON deserializer like Gson ( https://github.com/
> google/gson ) to deserialize your data. Here’s an example of how that
> might look (a json-file and a simple java class that uses Gson to
> deserialize it into a java class graph).
>
> https://gist.github.com/hugith/a697bbd2c8a6f43d015f
>
> Cheers,
> - hugi
>
>
> > On 6. feb. 2016, at 21:53, jazzsalsa <email@hidden> wrote:
> >
> > Hi list,
> >
> > I have a question about a nested NSMutableDictionary. Some of the
> > objects in the dictionary consist of another NSMutableDictionary.
> > Usage
> > here is a nested JSON object which is converted to a dictionary.
> >
> > For the first level I get all the keys:
> >
> > log.info("All keys: " + dict.allKeys().arrayList());
> >
> > The next child I get by:
> >
> > NSArray children = (NSArray)dict.objectForKey("children");
> >
> > But how to get to the next level? Probably I am doing this all
> > wrong
> > since it should be easy to flatten all entries in a nested
> > dictionary,
> > but I am new to this. There should be a better way of doing this
> > than
> > writing a recursive tree crawler. Does this make sense?
> >
> > Many thanks, Bart
> > _______________________________________________
> > Do not post admin requests to the list. They will be ignored.
> > Webobjects-dev mailing list (email@hidden)
> > Help/Unsubscribe/Update your Subscription:
> > enn.is
> >
> > This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden