AX - Asp Xtreme Evolution - 经典asp的Json解析器

时间:2013-06-05 20:57:00

标签: json asp-classic vbscript

有没有人用过这个并让它运转起来?我遇到了真正的问题,因为它告诉我有一个JScript错误,我不知道如何解决它。

这里的链接是为了获得产品的一些背景知识,但它是经典asp的JSON解析器。 Iterating though a JSON return using ASP Xtreme Evolution

我确信我在另一天工作了,但是现在我又回到了它,它引发了一个JScript错误,我现在似乎无法使它工作。

所以,我将JSON发布到经典的asp页面,这是我用来包含所有教程中指示的json2.asp页面的代码:

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="json2.asp"-->"%>
<% 'json processing details here..

它抛出的错误是在json2.asp的一行上,这是一个JScript错误。这是确切的错误:

Microsoft JScript compilation error '800a03ea' 
Line 765 json2.asp

我相信这是Crockfords json2.js的一个版本,我认为它在asp页面中的原因是它可以使用JScript,但它对我来说并没有进展。任何人都知道我说的是什么可以帮我解决掉我的头发之前的事情吗?!

如果您需要更多信息,请告诉我们 - 非常感谢

更新

这是第765行(在评论之间的中间)

if (/^[\],:{}\s]*$/.
test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {

// In the third stage we use the eval function to compile the text into a
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
// in JavaScript: it can begin a block or an object literal. We wrap the text
// in parens to eliminate the ambiguity.

        j = eval('(' + text + ')');

// In the optional fourth stage, we recursively walk the new structure, passing
// each name/value pair to a reviver function for possible transformation.

        return typeof reviver === 'function' ?
             walk({'': j}, '') : j;
}

1 个答案:

答案 0 :(得分:0)

你没有包括正确的东西。您需要整个库,并包含以下文件(适当地更改路径)。

<!-- #include file="includes/extlib/axe/base.asp" -->
<!-- #include file="includes/extlib/axe/classes/Parsers/json.class.asp" -->

然后实际使用,你做这样的事情:

set oJson = new Json
oJson.loadJson(strJSON)

strSomething = oJson.getElement("theElement")

set oJson = nothing

所有这些都来自工作代码。

相关问题