Subscribe to Subscribers

Forums » .NET » Webservices »

How to consume data from json file through webservice?


Posted Date: 09 Jul 2012      Posted By:: Mrudula     Member Level: Bronze    Member Rank: 2869     Points: 2   Responses: 1



Hi friends,

i have a req like i need to create a webservice which will be used to read data from a json file and put the data back into a table.

Any idea how to go for this?

and also i wnat to know abt json files?how they are created and how they are usefull.

Thanks in Advance
Mrudula




Responses

#680262    Author: Abhishek Arya      Member Level: Gold      Member Rank: 19     Date: 13/Jul/2012   Rating: 2 out of 52 out of 5     Points: 4

example of simple jason data. It will just like text file. Below link will give you someidea

http://json.codeplex.com/

System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer();
string json = @"{
'key1': 'value1',
'key2': 'value2',
'key3': false,
'key4': 10
}";
Dictionary<string, string> dic = js.Deserialize<Dictionary<string, string>>(json); // deserialize

foreach (KeyValuePair<string,string> o in dic)
{
// do whatever
}


dic.Add("newKey", "new value"); // add an attribute

string newjson = js.Serialize(dic); // serialize back to string


 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Next : Call button click event from webmethod
Previous : Can byte[] be a input to webservice
Return to Discussion Forum
Post New Message
Category:

Related Messages

Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Talk to Webmaster Tony John
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
2005 - 2013 All Rights Reserved.
.NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
Articles, tutorials and all other content offered here is for educational purpose only.
We are not associated with Microsoft or its partners.