How do I put my return data from an asmx into JSON? I'm having trouble finding decent literature

Posted by jphenow on Stack Overflow See other posts from Stack Overflow or by jphenow
Published on 2010-06-15T13:11:12Z Indexed on 2010/06/15 13:12 UTC
Read the original article Hit count: 325

Filed under:
|
|
|

I want to return an array of javascript objects from my asp.net asmx file. ie.

variable = [
    {
        *value1*: 'value1',
        *value2*: 'value2',
        ...,
    },
    {
    .
    .
    }
];

I seem have been having trouble reaching this. I'd put this into code but I've been hacking away at it so much it'd probably do more harm than good in having this answered.

Basically I am using a web service to find names as people type the name. I'd use a regular text file or something but its a huge database that's always changing - and don't worry I've indexed the names so searching can be a little snappier - but I would really prefer to stick with this method and just figure out how to get usable JSON back to javascript. I've seen a few that sort of attempt to describe how one would approach this but I honestly think microsofts articles are damn near unreadable.

Thanks in advance for assistance.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about JavaScript