IronPython的 - JSON的选择IronPython、JSON

2023-09-07 08:34:34 作者:Sharon 陌流年

什么是处理JSON在IronPython的2.0.1的最佳方法。本机Python的标准库的JSON看起来是尚未实现。

What is the best way to deal with JSON in IronPython 2.0.1. The native Python "standard library" json looks to be not implemented yet.

如果我想用Newtonsoft Json.NET库是如何做到这一点?我可以在程序集添加到GAC,但什么是我的其他选择吗?

If I wanted to use the Newtonsoft Json.NET library how do I do this? I could add the assembly to the GAC, but what are my other choices?

推荐答案

这个链接提供了补充refernces到.NET的DLL与IronPython的方式概述:的海博罗的博客:IronPython的:clr.AddReference

This link provides an overview of the ways to add refernces to .Net dlls with IronPython: Haibo Luo's weblog : IronPython: clr.AddReference

因此​​,举例来说,如果你likle,以避免将Json.NET库在GAC中,你可以使用

So, for example, if you'd likle to avoid placing the Json.NET library in the GAC you can use

进口CLR clr.AddReferenceToFile(jsonnet.dll)

import clr clr.AddReferenceToFile("jsonnet.dll")

clr.AddReferenceToFileAndPath(C:\\ \\库jsonnet.dll)

 
精彩推荐