Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.

What's the best practice for serializing information using Json, Unity & UWP?

I'm developing for the HoloLens & i'm looking for best practices for serializing using Json, UWP & Unity.

Json using NuGet doesn't look to be compatible with Unity.

Does anyone have a solution?

Best Answers


  • @mark_grossnickle said:
    Check the Unity asset store. There are a lot of options. Personally I've been using one that comes with Best HTTP Pro but I wouldn't recommend that package if you are only needing JSON as there should be some free options.

    Thanks Mark. Unity Asset Store packages may not be available for sharing legally on github... and my code would be based on it, which makes the package a requirement for anyone else... I wish Unity Object serailization was a native function in Unity or HoloToolkit

  • Does anyone recommend any packages? Tks

  • @Jeff_Blumenthal said:
    Does anyone recommend any packages? Tks

    I am using Windows.Data.Json. It is plain and simple.

    e.g. 1
    var jsonObject = new JsonObject();
    jsonObject.add("name", JsonValue.CreateStringValue("John"));
    jsonObject.add("surname", JsonValue.CreateStringValue("Doe"));
    var jsonString = jsonObject.Stringify();


    var jsonObject = new JsonObject {
    {"name", JsonValue.CreateStringValue("John")},
    {"surname", JsonValue.CreateStringValue("Doe")}

  • NewtonSoft.Json can be used with Unity in both the editor and on the HoloLens. Their NuGet package has support for everything from .Net 2.0 through UWP.

    You can get the package to your local machine by installing the NuGet command line exe and then executing

    NuGet Install Newtonsoft.json

    From there you'll need to copy the right DLLs into Unity and configure them as plugins. You'll do this with the Plugin Inspector which you can read about here.

    You might be able to get away with using the portable version with both the editor and UWP. I can't remember if this works. Otherwise you can use the Net 2.0 version for the editor and the Net 45 version with UWP. You may have to do small conditional compile changes if you find differences.

    This approach is not as easy as just getting a tool from the asset store, but it is fully supported for open source and it also allows you to write code that is reusable across other UWP projects.

    Our Holographic world is here

    RoadToHolo.com      WikiHolo.net      @jbienz
    I work in Developer Experiences at Microsoft. My posts are based on my own experience and don't represent Microsoft or HoloLens.

  • @jbienzms : Did you test the approach mentioned by you. Can I do it this on .Net 3.5 runtime in Unity

Sign In or Register to comment.