?
Solved

run JSON script in .NET

Posted on 2014-07-15
1
Medium Priority
?
235 Views
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
0
Comment
Question by:Rawan Jambi
1 Comment
 
LVL 22

Accepted Solution

by:
Ivo Stoykov earned 1000 total points
ID: 40196638
Hi

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

HTH
Ivo Stoykov
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

579 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