Well, the best method would be to include JSON.NET and output it:
var aaa = <%= JsonConvert.Serialize(aaa) %>;
Then, no matter if it's a string, integer, array, or whatever it'll be serialized in a way that JS can handle it. this will also handle any kind of escaping if necessary (e.g. aaa = "Hello \"World\"!")
Another option is to retrieve it with a handler/AJAX (but that's a little too much overhead for such a simple task).
Finally, you can register the script:
Type type = this.GetType();
string scriptName = "assign aaa";
ClientScriptManager clientScript = Page.ClientScript;
if (!clientScript.IsClientScriptBlockRegistered(type, scripName))
{
StringBuilder sb = new StringBuilder();
sb.Append("<script type=\"text/javascript\">")
.AppendFormat("var aaa = {0};", JsonConvert.Serialize(aaa))
.Append("</" + "script>");
clientScript.RegisterClientScriptBlock(type, scripName, sb.ToString());
}
But the above is just a more elaborate way of ending up with a <script> tag anyways.
RegisterStartupScriptmsdn.microsoft.com/en-us/library/bahh2fef.aspx