Loading ...
Sorry, an error occurred while loading the content.

549How to acess Java Objects, using JSON

Expand Messages
  • krish777
    Oct 22, 2006

      I am new to JSON an I am learning JSON. I have a question for the group.

      I have a button and onclick of the button, I am calling a servlet and
      I want to pass Person Object to the client. In doGet() method I am
      doing the following things

      JSONObject obj = new JSONObject();
      Vector v = new Vector();
      v.add(new Employee("Jim", "1"));
      v.add( new Employee("Tom", "2"));
      obj.put("emp", v);

      In Call back javascript, how to access the properties of the employee

      var jsonExpression = "(" + object.responseText + ")";
      var customer = eval(jsonExpression);

      I want to display back employee name and employee id.

      Please help.
    • Show all 4 messages in this topic