使用Rhino shell脚本中的NativeJSON

时间:2013-09-19 22:26:36

标签: json shell rhino

我想使用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脚本获取它的?

1 个答案:

答案 0 :(得分:1)

NativeJSON类是ECMAScript 5中JSON对象的实现,因此您不需要做任何特殊操作。您可以致电JSON.stringify(object)JSON.parse(jsonString)

来访问它