开发者

Parsing and Writing JSON using Ant

Has anyone managed to parse and write JSON in a task in Ant?

I need to parse a json file, modify it and then write it back on disk. I managed to parse it using the rhino engine from JDK 6 but i'm stuck because I don't know how to ser开发者_C百科ialize it back to disk.

It seemes I need a JSON serializer, rhino does not apparently include one.


Recent versions of Rhino should have a JSON object: see this bug that was resolved as fixed in 2010, and the actual class is called NativeJSON and has a stringify method that should let you retrieve a JSON string.


JSON.stringify is available with Rhino 1.7R3 onwards as part of the ECMAScript 5 work.

See: https://developer.mozilla.org/En/New_in_Rhino_1.7R3

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜