Search code examples
.netjsonironpythondynamic-language-runtime

IronPython - JSON choices


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.

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?


Solution

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

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

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

    or

    clr.AddReferenceToFileAndPath("C:\\libraries\\jsonnet.dll")