admin管理员组文章数量:1201421
I have inherited some Classic ASP code and I need a JSON library that can be instantiated and run server-side for use with JavaScript-coded server-side ASP.
How can I do this?
I have inherited some Classic ASP code and I need a JSON library that can be instantiated and run server-side for use with JavaScript-coded server-side ASP.
How can I do this?
Share Improve this question edited Dec 16, 2016 at 9:58 dakab 5,87510 gold badges45 silver badges70 bronze badges asked Feb 18, 2010 at 22:06 dreftymacdreftymac 32.4k26 gold badges124 silver badges187 bronze badges4 Answers
Reset to default 10In my experience, JSON2.js works in Classic ASP.
To use it, I do this in the .asp code:
<%@ language="Javascript" %>
<script language="javascript" runat="server" src='json2.js'></script>
<script language="javascript" runat="server">
... my code here....
// use the JSON object:
var jsonRepresentation = JSON.stringify(myObject, null, 2);
</script>
For writing/outputting JSON i believe the aspjson project is a pretty good choice. Parsing JSON in ASP "classic" is discussed here:
- Any good libraries for parsing JSON in Classic ASP?
In that thread, Chris Nielsen has a creative idea of using a Javascript library on the server side (as ASP supports JScript as well as VBScript). I have not tried it, but maybe that could solve both parsing and writing.
I've used aspjson with great success.
http://code.google.com/p/aspjson/
You could try something similar to this: http://www.lshift.net/blog/2005/10/11/simple-ajax-with-json-chat-application-for-asp-30
It has a fairly direct encapsulation of the old json.js into a json.asp file for running on the server-side.
本文标签: javascriptClassic ASP serverside JSON libraryStack Overflow
版权声明:本文标题:javascript - Classic ASP server-side JSON library - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738624269a2103368.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论