我想使用Rhino shell脚本中的NativeJSON class。我能找到的关于如何在Web上使用它的唯一内容来自Java。
// Load the configuration file
load(arguments[0]);
// Extract the configuration for the target environment
print(NativeJSON.stringify(environments[arguments[1]]));
我是如何从Rhino shell脚本获取它的?
答案 0 :(得分:1)
NativeJSON
类是ECMAScript 5中JSON
对象的实现,因此您不需要做任何特殊操作。您可以致电JSON.stringify(object)
或JSON.parse(jsonString)
。