none
How to parse JSON file in C# in VS 2010? RRS feed

  • Question

  • Hi,

    I am given an url that is a json file. How do I parse the file in VS2010? I just want to install Newtonsoft.Json, and I just installed NuGet, version '2.8.60318.667' is the one that is defaulted to VS2010. So, I received an error the following error:

    Install-Package : The 'Newtonsoft.Json 10.0.3' package requires NuGet client version '2.12' or above, but the current NuGet version is '2.8.60318.667'.

    How do I resolve this? Or can I use any other approach for parsing JSON file?

    Thanks

    Wanda

    Tuesday, November 7, 2017 8:41 PM

All replies

  • https://www.newtonsoft.com/json

    You can't go to the site?

    Tuesday, November 7, 2017 9:41 PM
  • The problem is you are using VS 2010. Yesterday I researched how to write (serialize) JSON. I found many confusing things. I found things saying I must install the NuGet package. I was not sure what I needed to do or not do. Finally I added a reference for Newtonsoft.Json and a using for it and it works. Since you are using VS 2010 I am not sure it is so easy. I don't understand NuGet so it is unclear when I need it. It is such a Black Box. And since it is called Newtonsoft.Json I am not sure if it is a Microsoft thing or what. So I know from experience that it can be confusing. JSON is relatively simple, it is frustrating that using it is so complicated.

    I avoid using the NuGet command line when possible. You can right-click on your project and select "Manage NuGet Packages..." and do most things interactively. You can try undoing what if you have done (if anything) using NuGet then just add the reference and the using statement as I did. If that works then you can just ignore NuGet for this. But I am not an expert, I am just trying to help with what works for me.



    Sam Hobbs
    SimpleSamples.Info

    Wednesday, November 8, 2017 12:24 AM
  • The top of that page has a download link but as best as I can tell it already exists for us with .Net or VS. That page does not seem to show the part that this question asks about; how to get the NuGet package installed. Perhaps this is a NuGet question but I suspect we don't need to use NuGet. The 'Newtonsoft web site does not specify what reference to use if we can do that.

    Where does the VS and/or .Net documentation say we must go to the 'Newtonsoft web site? I would be skeptical about using the 'Newtonsoft web site since I don't know if it is compatible with the version installed by VS and /or .Net.



    Sam Hobbs
    SimpleSamples.Info


    Wednesday, November 8, 2017 12:31 AM
  • Hello wkpli,

    >>Install-Package : The 'Newtonsoft.Json 10.0.3' package requires NuGet client version '2.12' or above, but the current NuGet version is '2.8.60318.667'.

    Some packages can be only installed with the newest version of Nuget Package Manager, as for workaround, You need to update NuGet to the new version.If you go to the Tools -> Extension manager menu in visual studio you will find a list of installed extensions.  

    Once you have found Nuget Package Manager you will be allowed to update it. And then have to restart Visual studio and you will be able to install your package.

    https://stackoverflow.com/questions/42173657/package-requires-nuget-client-version-2-12/42175747

    Best regards,

    Neil Hu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, November 8, 2017 7:04 AM
    Moderator
  • Except I am using the NuGet.Json library without using NuGet. If that is possible then it seems better to use the simpler solution. Is there any documentation saying that we must use NuGet?


    Sam Hobbs
    SimpleSamples.Info

    Wednesday, November 8, 2017 7:30 AM