Hi
I am new to FlexJson and was following http://flexjson.sourceforge.net/ for simple tutorial.
I wrote a simple program but it seems not to be serializing the object attributes. Please help me if someone knows about this
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.webapp.enter;
import flexjson.JSONSerializer;
/**
*
* @author harit
*/
class PObject {
String name;
int age;
String country;
public PObject (String n, int a , String c){
this.name = n;
this.country = c;
this.age = a;
}
public String toString(){
return this.name + this.age + this.country;
}
public String[] getData(){
return new String[]{ this.name, this.country};
}
}
public class Person{
public static void main(String main[]){
PObject person = new PObject("harit",23,"india");
System.out.println(person.name + " - " + person.age + " - " + person.country);
JSONSerializer serializer = new JSONSerializer();
String out = serializer.serialize(person);
System.out.println("S : " + out);
}
}
Output:
init:
deps-module-jar:
deps-ear-jar:
deps-jar:
compile-single:
run-main:
harit - 23 - india
S : {"class":"com.webapp.enter.PObject"}
BUILD SUCCESSFUL (total time: 0 seconds)