<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How To Create A JSON Web Service In ASP.NET</title>
	<atom:link href="http://williamsportwebdeveloper.com/cgi/wp/?feed=rss2&#038;p=494" rel="self" type="application/rss+xml" />
	<link>http://williamsportwebdeveloper.com/cgi/wp/?p=494</link>
	<description>Brief notes on what I am up to as a web developer in Williamsport PA, Lycoming County.</description>
	<lastBuildDate>Sun, 05 Sep 2010 03:47:34 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: TG</title>
		<link>http://williamsportwebdeveloper.com/cgi/wp/?p=494&#038;cpage=1#comment-74293</link>
		<dc:creator>TG</dc:creator>
		<pubDate>Fri, 05 Feb 2010 11:30:18 +0000</pubDate>
		<guid isPermaLink="false">http://williamsportwebdeveloper.com/cgi/wp/?p=494#comment-74293</guid>
		<description>hehe... Another free tool: http://jsonviewer.stack.hu</description>
		<content:encoded><![CDATA[<p>hehe&#8230; Another free tool: <a href="http://jsonviewer.stack.hu" rel="nofollow">http://jsonviewer.stack.hu</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andre</title>
		<link>http://williamsportwebdeveloper.com/cgi/wp/?p=494&#038;cpage=1#comment-70464</link>
		<dc:creator>Andre</dc:creator>
		<pubDate>Fri, 13 Nov 2009 12:05:05 +0000</pubDate>
		<guid isPermaLink="false">http://williamsportwebdeveloper.com/cgi/wp/?p=494#comment-70464</guid>
		<description>can i call this service from a different domain or must the service and consuming application be within the same domain?</description>
		<content:encoded><![CDATA[<p>can i call this service from a different domain or must the service and consuming application be within the same domain?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick Tulett</title>
		<link>http://williamsportwebdeveloper.com/cgi/wp/?p=494&#038;cpage=1#comment-69734</link>
		<dc:creator>Nick Tulett</dc:creator>
		<pubDate>Wed, 21 Oct 2009 13:06:31 +0000</pubDate>
		<guid isPermaLink="false">http://williamsportwebdeveloper.com/cgi/wp/?p=494#comment-69734</guid>
		<description>Well, I got to work and my code broke spectacularly ;) Seems my bodged VM at home has an old version of ASP.NET and returning Dictionary isn&#039;t allowed now.

I don&#039;t know whether JaggedArray or Dictionary has any performance implications, but I&#039;m now using:

public string DataTable2JSON(DataTable dt)
    {
        List RowList = new List();
        foreach (DataRow dr in dt.Rows)
        {
            Dictionary ColList = new Dictionary();
            foreach (DataColumn dc in dt.Columns)
            {
                ColList.Add(dc.ColumnName,
                    (string.Empty == dr[dc].ToString()) ? null : dr[dc]);
            }
            RowList.Add(ColList);
        }
        JavaScriptSerializer js = new JavaScriptSerializer();
        string JSON = js.Serialize(RowList);
        return JSON;
    }</description>
		<content:encoded><![CDATA[<p>Well, I got to work and my code broke spectacularly <img src='http://williamsportwebdeveloper.com/cgi/wp/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Seems my bodged VM at home has an old version of ASP.NET and returning Dictionary isn&#8217;t allowed now.</p>
<p>I don&#8217;t know whether JaggedArray or Dictionary has any performance implications, but I&#8217;m now using:</p>
<p>public string DataTable2JSON(DataTable dt)<br />
    {<br />
        List RowList = new List();<br />
        foreach (DataRow dr in dt.Rows)<br />
        {<br />
            Dictionary ColList = new Dictionary();<br />
            foreach (DataColumn dc in dt.Columns)<br />
            {<br />
                ColList.Add(dc.ColumnName,<br />
                    (string.Empty == dr[dc].ToString()) ? null : dr[dc]);<br />
            }<br />
            RowList.Add(ColList);<br />
        }<br />
        JavaScriptSerializer js = new JavaScriptSerializer();<br />
        string JSON = js.Serialize(RowList);<br />
        return JSON;<br />
    }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick Tulett</title>
		<link>http://williamsportwebdeveloper.com/cgi/wp/?p=494&#038;cpage=1#comment-69715</link>
		<dc:creator>Nick Tulett</dc:creator>
		<pubDate>Tue, 20 Oct 2009 21:59:47 +0000</pubDate>
		<guid isPermaLink="false">http://williamsportwebdeveloper.com/cgi/wp/?p=494#comment-69715</guid>
		<description>I don&#039;t think the jagged array or serializer are necessary if you return a List, rather than a string:
[WebMethod]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public List getSQLRowByValue(string strTable, string strCol, string strValue)
        {
            DataTable dt = getSQLrow(strTable, strCol, strValue);//returns a DataTable - could be from MySQL ODBC in your case
            List RowList = new List();
            foreach (DataRow dr in dt.Rows)
            {
                Dictionary ColList = new Dictionary();
                foreach (DataColumn dc in dt.Columns)
                {
                    ColList.Add(dc.ColumnName,
                        (string.Empty == dr[dc].ToString()) ? null : dr[dc]); ;
                }
                RowList.Add(ColList);
            }
            return RowList;
        }</description>
		<content:encoded><![CDATA[<p>I don&#8217;t think the jagged array or serializer are necessary if you return a List, rather than a string:<br />
[WebMethod]<br />
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]<br />
        public List getSQLRowByValue(string strTable, string strCol, string strValue)<br />
        {<br />
            DataTable dt = getSQLrow(strTable, strCol, strValue);//returns a DataTable &#8211; could be from MySQL ODBC in your case<br />
            List RowList = new List();<br />
            foreach (DataRow dr in dt.Rows)<br />
            {<br />
                Dictionary ColList = new Dictionary();<br />
                foreach (DataColumn dc in dt.Columns)<br />
                {<br />
                    ColList.Add(dc.ColumnName,<br />
                        (string.Empty == dr[dc].ToString()) ? null : dr[dc]); ;<br />
                }<br />
                RowList.Add(ColList);<br />
            }<br />
            return RowList;<br />
        }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ContinousLearner: Links (7/30/2009) &#124; Astha</title>
		<link>http://williamsportwebdeveloper.com/cgi/wp/?p=494&#038;cpage=1#comment-67971</link>
		<dc:creator>ContinousLearner: Links (7/30/2009) &#124; Astha</dc:creator>
		<pubDate>Wed, 09 Sep 2009 05:28:12 +0000</pubDate>
		<guid isPermaLink="false">http://williamsportwebdeveloper.com/cgi/wp/?p=494#comment-67971</guid>
		<description>[...] How To Create A JSON Web Service In ASP.NET [...]</description>
		<content:encoded><![CDATA[<p>[...] How To Create A JSON Web Service In ASP.NET [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brothel Locator Web Service In COBOL &#8211; Williamsport Web Developer Weblog</title>
		<link>http://williamsportwebdeveloper.com/cgi/wp/?p=494&#038;cpage=1#comment-65377</link>
		<dc:creator>Brothel Locator Web Service In COBOL &#8211; Williamsport Web Developer Weblog</dc:creator>
		<pubDate>Wed, 29 Jul 2009 22:28:43 +0000</pubDate>
		<guid isPermaLink="false">http://williamsportwebdeveloper.com/cgi/wp/?p=494#comment-65377</guid>
		<description>[...] Yahoo! Maps - Twitter        &#171; How To Create A JSON Web Service In ASP.NET [...]</description>
		<content:encoded><![CDATA[<p>[...] Yahoo! Maps &#8211; Twitter        &laquo; How To Create A JSON Web Service In ASP.NET [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert S. Robbins</title>
		<link>http://williamsportwebdeveloper.com/cgi/wp/?p=494&#038;cpage=1#comment-65320</link>
		<dc:creator>Robert S. Robbins</dc:creator>
		<pubDate>Tue, 28 Jul 2009 23:58:00 +0000</pubDate>
		<guid isPermaLink="false">http://williamsportwebdeveloper.com/cgi/wp/?p=494#comment-65320</guid>
		<description>Sandra Dee, I use a free JSON Viewer available at: http://www.codeplex.com/JsonViewer I even made a minor improvement to it.</description>
		<content:encoded><![CDATA[<p>Sandra Dee, I use a free JSON Viewer available at: <a href="http://www.codeplex.com/JsonViewer" rel="nofollow">http://www.codeplex.com/JsonViewer</a> I even made a minor improvement to it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sandra Dee</title>
		<link>http://williamsportwebdeveloper.com/cgi/wp/?p=494&#038;cpage=1#comment-65277</link>
		<dc:creator>Sandra Dee</dc:creator>
		<pubDate>Tue, 28 Jul 2009 09:10:54 +0000</pubDate>
		<guid isPermaLink="false">http://williamsportwebdeveloper.com/cgi/wp/?p=494#comment-65277</guid>
		<description>I prefer JSON when communicating with my web services as well. One difficulty that I encountered is that when the JSON came across the wire it was very difficult to read because it was compressed unlike the XML which was well-formatted. I found a tool called JSON Pro Viewer which helps drastically to view and edit large/deeply nested JSON documents:
http://www.jsonpro.com</description>
		<content:encoded><![CDATA[<p>I prefer JSON when communicating with my web services as well. One difficulty that I encountered is that when the JSON came across the wire it was very difficult to read because it was compressed unlike the XML which was well-formatted. I found a tool called JSON Pro Viewer which helps drastically to view and edit large/deeply nested JSON documents:<br />
<a href="http://www.jsonpro.com" rel="nofollow">http://www.jsonpro.com</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: You are now listed on FAQPAL</title>
		<link>http://williamsportwebdeveloper.com/cgi/wp/?p=494&#038;cpage=1#comment-65229</link>
		<dc:creator>You are now listed on FAQPAL</dc:creator>
		<pubDate>Tue, 28 Jul 2009 00:47:56 +0000</pubDate>
		<guid isPermaLink="false">http://williamsportwebdeveloper.com/cgi/wp/?p=494#comment-65229</guid>
		<description>&lt;strong&gt;How To Create A JSON Web Service In ASP.NET...&lt;/strong&gt;

This article and sample code will show you how to get your web service to return data in the JSON format....</description>
		<content:encoded><![CDATA[<p><strong>How To Create A JSON Web Service In ASP.NET&#8230;</strong></p>
<p>This article and sample code will show you how to get your web service to return data in the JSON format&#8230;.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
