Hi I have this class called: Message ... like this:
public class Message {
private var _to:String;
private var _from:String;
private var _subject:String;
private var _content:Array;
public function Message(){
}
public function get to():String {
return _to;
}
public function set to(value:String):void {
_to = value;
}
public function get from():String {
return _from;
}
public function set from(value:String):void {
_from = value;
}
public function get subject():String {
return _subject;
}
public function set subject(value:String):void {
_subject = value;
}
public function get content():Array {
if (_content == null) {
_content = new Array();
}
return _content;
}
public function set content(value:Array):void {
_content = value;
}
}
then another class called KeyValue, like this:
public class KeyValue {
private var _key:String;
private var _value:String;
public function KeyValue(key:String, value:String){
this._key = key;
this._value = value;
}
public function get key():String {
return _key;
}
public function set key(value:String):void {
_key = value;
}
public function get value():String {
return _value;
}
public function set value(value:String):void {
_value = value;
}
}
Then I create a new instance of a Message class, and populate its
array field with 2 KeyValue objects, so when I encode it with JSON it
will turn out the string like below:
{"from":"Yunia","content":[{"value":"keyone value","key":"keyone"},
{"value":"keytwo
value","key":"keytwo"}],"subject":"HelloBromo","to":"Bromo"}
I tried to parse back the above json string back to Message object but
failed ... can u please show me how?
--
You received this message because you are subscribed to the Google Groups "ActionScript 3 Core Library" group.
To post to this group, send email to
as3co...@googlegroups.com.
To unsubscribe from this group, send email to
as3corelib+...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/as3corelib?hl=en.