Results 1 to 2 of 2

Thread: Not able to retrieve JSON Object in Json format on the Server side.

  1. #1
    Sencha User
    Join Date
    Apr 2011
    Surat, Gujarat, India
    Vote Rating

    Thumbs up Not able to retrieve JSON Object in Json format on the Server side.

    Hi.. sencha forum member i need one help from you.

    I am developing an application in which I am interacting with the database using proxy api: create, read, update, destroy.

    I am done to read the data from the server side. Now I want to create new record by passing data from the view to my server side controller.

    When i click the save button my create api calls and execute POST that interact of the controller.
    after clicking the save button my json data submitted is
    taskdata [Object { Name="New task", StartDate="2010-02-13T05:30:00", EndDate="2010-02-23T05:30:00", more...}]
    0 Object { Name="New task", StartDate="2010-02-13T05:30:00", EndDate="2010-02-23T05:30:00", more...}
    Duration 1
    DurationUnit "d"
    EndDate "2010-02-23T05:30:00"
    Id null
    ManuallyScheduled false
    Name "New task"
    PercentDone 0
    Priority 1
    StartDate "2010-02-13T05:30:00"
    checked null
    depth 1
    index 2
    parentId null
    {"taskdata":[{"Id":null,"Name":"New task","StartDate":"2010-02-13T05:30:00","EndDate":"2010-02-23T05:30:00","Duration":1,"DurationUnit":"d","PercentDone":0,"ManuallyScheduled":false,"Priority":1,"parentId":null,"index":2,"depth":1,"checked":null}]}
    on the server side when i print the data which i had passed it gives me
    {    taskdata = [{
            Id = null,
            Name = New task,
            StartDate = 2010 - 02 - 13T05: 30: 00,
            EndDate = 2010 - 02 - 23T05: 30: 00,
            Duration = 1,
            DurationUnit = d,
            PercentDone = 0,
            ManuallyScheduled = false,
            Priority = 1,
            parentId = null,
            index = 2,
            depth = 1,
            checked = null
    what mistake i am making that my json data is full converted to Array. I want my data to be in json format only.

    I am using spring for the server side beans management and the controller to make my work done.

    my function that gives me above output is
    @RequestMapping(value= "/task/CreateTask.action")	public @ResponseBody Map<String, ? extends Object> createTask(@RequestBody Map<String, Object> taskdata) throws Exception {
    		try {
    			System.out.println("INSIDE CREATE TASK :"+taskdata);
    			List<Task> tasks = ganttService.createTask(taskdata);
    			return getMapTask(tasks);
    		}catch(Exception e) {
    			return getModelMapError("Error in creating Task");
    Yogendra Singh
    Sr. Programmer

  2. #2
    Sencha User's Avatar
    Join Date
    Mar 2007
    DC Area =)
    Vote Rating


    your JSON is OK. I'm confused as to what doesn't work and why. All you've shown is the server side stuff.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts