I'm connecting to a webservice and getting JSON back, creating a JSONObject/JSONArray which I then want back as it's foundation equivalent of say NSDictionary.

I'm sure this has been done already and I'm looking at Wonders NSArraySerializer and NSDictionarySerializer but I think I'm missing some knowledge about these things, I need to register them with a Bridge or something perhaps?

Using tryUnmarshall I get an error of "source object must be already registered as a ProcessedObject" with the following probably very wrong code:

String s = jsonStringFromWebService();
JSONObject results = new JSONObject(s);
JSONObject jo = new JSONObject();
jo.put("javaClass", NSArray.class.getCanonicalName());
jo.put("nsarray", results.get("results"));
NSArraySerializer nas = new NSArraySerializer();
SerializerState ss = new SerializerState();
try {
        ObjectMatch m = nas.tryUnmarshall(ss, NSArray.class , jo);
        log.info(m);
} catch (UnmarshallException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
}

Thanks

Paul S
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to