Hi,
I'm writing an iphone application with JSON and am trying to turn JSON strings into objects (NOT Dictionaries or Arrays).
In Java, thanks to Reflection, I can easily turn JSON into javabean instances like this:
import net.sf.json.JSONObject;
class MyBean {
private String property;
public String getProperty() { return property; }
public void setProperty(String property) { this.property=property; }
}
// turn JSON string into a MyBean instance
String str = "{\"property\":\"some value\"}";
JSONObject jsonObject = (JSONObject) JSONSerializer.toJSON( str );
JsonConfig jsonConfig = new JsonConfig();
jsonConfig.setRootClass( MyBean.class );
MyBean instance = (MyBean) JSONSerializer.toJava( jsonObject, jsonConfig );
I was wondering if this was possible in objective-c. I am currently using this JSON framework but am willing to switch if necessary.
Thanks,