run JSON script in .NET

Posted on 2014-07-15
Last Modified: 2016-02-24
I have a JSON script from Google Analytics and I would like to run it in Visual Studio 2013.
I run (Install-Package Newtonsoft.Json ) in the package manager console but I don't know where to paste the script and how I can run it.. and a very important question is what type of project should I create at the beginning to run the script (Class library, Console application,...??) ??

Anyone has and idea what are the steps to do it!!

Thank you
Question by:Rawan Jambi
    1 Comment
    LVL 22

    Accepted Solution


    The best way to start is documentations ... But here is a quick start sample:
    Product product = new Product(); // you need some object to serialise
    product.Name = "Apple";
    product.ExpiryDate = new DateTime(2008, 12, 28);
    product.Price = 3.99M;
    product.Sizes = new string[] { "Small", "Medium", "Large" };
    string output = JsonConvert.SerializeObject(product);
    // and result is:
    //  "Name": "Apple",
    //  "ExpiryDate": "2008-12-28T00:00:00",
    //  "Price": 3.99,
    //  "Sizes": [
    //    "Small",
    //    "Medium",
    //    "Large"
    //  ]
    Product deserializedProduct = JsonConvert.DeserializeObject<Product>(output); // restore back to original object ...

    Open in new window

    Ivo Stoykov

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (…
    This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now