I newbie in JSON Programming . I have scratched to much youtube and also google about the retrieve of data into string json using C# windows form application ..

I haven't found anything till now.

Please give a example and step by step procedure of how to retrieve the data from URL into JSON string using C# windows forms application . I don't want any big application in demo.

Please its my request to give a step by step procedure of how retrieve data .

Please Please Help me .!!!!

You'll first have to download JSON.net

Here's a simple example....

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using Newtonsoft.Json;


class Program
{
    static void Main(string[] args)
    {
        using (WebClient webClient = new System.Net.WebClient())
        {
            WebClient n = new WebClient();
            var json = n.DownloadString("http://data.mtgox.com/api/2/BTCUSD/money/ticker_fast");
            string valueOriginal = Convert.ToString(json);
                Console.WriteLine(json);
        }
    }
}

Thank You Mr. BobS0327..... This is example made it easy to learn new things .

Member Avatar for aclx

I tried it too but an unhandled error (An unhandled exception of type 'System.Net.WebException' occurred in System.dll) occurs. And i am not too sure why this happens. Any idea why?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.