Home:ALL Converter>JSONArray returning date as an object?

JSONArray returning date as an object?

Ask Time:2013-04-16T19:31:46         Author:Ree

Json Formatter

I am working in web development with java at serverside and javascript at clientside ... i access a java function using post method that returns a json ... while returning i get all the values through a json array but the date fieild is returning as [Object object] ... what to do to convert that object to date ?

List<LocateOffice> officeList = commonService.searchoffice(office, company, ocity, state, area);
            request.setAttribute("officeList",officeList);

if(officeList!=null)
            {
                JSONArray jsonArray = JSONArray.fromObject(officeList);
                response.getWriter().print(jsonArray.toString());
            }

after that in javascript when i access officelist json using for loop

alert(officelist[i].createdDate);

this alert returns [Object object]

Update : my question is not about alert() just for ur understanding purpose i entered code like that , wherever i use that json the date is returning an object ... how to convert that object to javascript date or string ...

Author:Ree,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/16035914/jsonarray-returning-date-as-an-object
yy