JSon

  • Thread starter Thread starter shapper
  • Start date Start date
S

shapper

Hello,

I need to create an aspx file which returns a JSON string.

In fact I want to return a specific string for testing a JQuery code I
am working in:

[{"TagID":"017b253e-596b-4328-85f5-
fd97a783759c","Name":"Física","FileTags":[],"ProfessorTags":[]},
{"TagID":"3fae2160-55f6-4dd0-b856-
fd27f5d307e2","Name":"Matemática","FileTags":[],"ProfessorTags":[]},
{"TagID":"883b197e-0cb3-4528-8403-0877d742bf47","Name":"Matemática
B","FileTags":[],"ProfessorTags":[]},{"TagID":"f183cb9d-9d92-4c61-b03a-
e51cc1205b2b","Name":"Português","FileTags":[],"ProfessorTags":[]}]

Could someone tell me how to do this?

Thanks,

Miguel
 
Hi

This is what you need i think...
check it out..http://www.aspcode.net/JQuery-and-ASPNET-returning-classes-with-JSON....

Best of luck

Hi,

I created the following for testing purposes:

/// <summary>
/// Summary description for $codebehindclassname$
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class MyData : IHttpHandler {

public void ProcessRequest(HttpContext context) {
context.Response.ContentType = "text/plain";
context.Response.Write("[{'TagID':'3fae2160-55f6-4dd0-b856-
fd27f5d307e2','Name':'Matemática','FileTags':[],'ProfessorTags':[]},
{'TagID':'883b197e-0cb3-4528-8403-0877d742bf47','Name':'Matemática
B','FileTags':[],'ProfessorTags':[]}]");
}

public bool IsReusable {
get {
return false;
}
}
}

However, I don't want to create and compile a project. I want only to
upload this to my server ... how can I call this from a simple aspx
page?

Thanks,
Miguel
 
Back
Top