Q:

How to convert the output of an .aspx into a JSON?

I need to convert the output of an .aspx page into a JSON object (due to a JSONP Ajax request).
In fact with this page :
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="mypage.aspx.cs" Inherits="folder_mypage" %>

<div class="myClass">Hello</div>

with jQuery, after the ajax call :
$.ajax({
    url: 'http://myownajax.projects.it/folder/mypage.aspx',
    dataType: 'jsonp',
    success: function(result) {
        console.log("it is ok");
    },

    error: function(jqXHR, textStatus, errorThrown) {
        console.log(textStatus + " - " + errorThrown);
    }                
});

I get parsererror - SyntaxError: class is a reserved identifier
That's why I need to convert "the output of the page" to JSON element.
How can I do it?
EDIT
In less words : I want to append an .aspx context to an element, client side! The request is cross-doman, that's why I need JSONP, which needed JSON as result! So, what I'm looking for is just this : take the HTML (as a string) and put in a JSON object. Like result.myHtmlString="<div class='myClass'>Hello</div>";

A:

you could do something like this (not tested, never used it myself, but it shows the general gist and the js-serializer)
class Result{
  public String Html{get;set;}
}

TextReader txtread = new TextReader("page.aspx");
string text = txtread.ReadToEnd();
var res = new Result(){Html=text};
JavaScriptSerializer serializer = new JavaScriptSerializer();
var json = serializer.Serialize(res);

Without using Serializer:
String html = new TextReader("page.aspx").ReadToEnd();
String json = "{ Html: '" + html + "'}";
return json;

json is a string!

