<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>epiphantastic &#187; CFJSON</title>
	<atom:link href="http://www.epiphantastic.com/category/cfjson/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.epiphantastic.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Wed, 13 Apr 2011 19:20:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>CFJSON 1.9, about time</title>
		<link>http://www.epiphantastic.com/2008/02/20/cfjson-19-about-time/</link>
		<comments>http://www.epiphantastic.com/2008/02/20/cfjson-19-about-time/#comments</comments>
		<pubDate>Wed, 20 Feb 2008 07:28:56 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[CFJSON]]></category>

		<guid isPermaLink="false">http://www.epiphantastic.com/?p=26</guid>
		<description><![CDATA[It&#8217;s been way too long I&#8217;ve owed an update of CFJSON. There were a few nagging bugs that needed to be addressed and I did my best to fix them. Another notable improvement was related to performance. Ray Camden pointed out that string concatenation wasn&#8217;t using the Java StringBuffer object. Doug Boude provided me with [...]]]></description>
			<content:encoded><![CDATA[<p>
It&#8217;s been way too long I&#8217;ve owed an update of CFJSON. There were a few nagging bugs that needed to be addressed and I did my best to fix them. Another notable improvement was related to performance. <a href="http://www.coldfusionjedi.com/">Ray Camden</a> pointed out that string concatenation wasn&#8217;t using the Java StringBuffer object. <a href="http://www.dougboude.com">Doug Boude</a> provided me with some code and I plugged it in, so encoding should be considerably faster when dealing with a lot of data.
</p>
<p>
Apologies to those who submitted other fixes/suggestions that are not addressed by this release. Either I found problems with the submission or including it would have further delayed a long-overdue release, so I figured I&#8217;d keep it for the next one. Either way, thanks for all the comments and code contributed.
</p>
<p>
For more details on the changes and to download the latest version, go to the <a href="/cfjson/downloads.php">CFJSON site<a/>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.epiphantastic.com/2008/02/20/cfjson-19-about-time/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CFJSON 1.8 is out</title>
		<link>http://www.epiphantastic.com/2007/05/12/cfjson-18-is-out/</link>
		<comments>http://www.epiphantastic.com/2007/05/12/cfjson-18-is-out/#comments</comments>
		<pubDate>Sat, 12 May 2007 19:21:20 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[CFJSON]]></category>

		<guid isPermaLink="false">http://www.epiphantastic.com/?p=25</guid>
		<description><![CDATA[It&#8217;s been a while I&#8217;ve updated CFJSON, I just finished looking over some suggestions I&#8217;d received by email and took a little time to implement and test them. One fix could be considered critical depending on your needs. Ray Camden pointed out that Yahoo&#8217;s JSON feeds escaped the forward-slash character, so a url was coming [...]]]></description>
			<content:encoded><![CDATA[<p>
It&#8217;s been a while I&#8217;ve updated CFJSON, I just finished looking over some suggestions I&#8217;d received by email and took a little time to implement and test them. One fix could be considered critical depending on your needs. <a href="http://ray.camdenfamily.com/">Ray Camden</a> pointed out that Yahoo&#8217;s JSON feeds escaped the forward-slash character, so a url was coming up as http:\/\/someURL.com . This was not being decoded correctly by CFJSON, which I fixed for this release. For consistency, I also modified the encode function to escape the forward-slash.
</p>
<p>
The next two changes are some optional features that might make your life easier. The first was a suggestion by Carl Anderson for the handling of numeric fields. He was having problems because he had some project codes like &#8220;5.10000&#8243; which javascript would convert to 5.1. He recommended that numbers be converted to strings by default in JSON. Because So he added a <em>stringNumbers</em> argument to the <em>encode()</em> function, when set to true it will encode numbers as strings. Because I don&#8217;t like to tamper with data unless necessary, I preferred to set the default to false.
</p>
<p>
Next up was the handling of dates. Thomas Jaworski pointed out that dates in an ODBC format like {ts &#8217;2007-04-15 16:03:25&#8242;} would be troublesome to parse, so he provided some code for the <em>encode()</em> function to format dates in a way that was friendly to javascript&#8217;s <em>new Date()</em> constructor. Again, because I don&#8217;t like to tamper with data I preferred to implement this as an option that is false by default. The <em>encode()</em> function takes an optional <em>formatDates</em> boolean argument which will format dates as follows: May 12, 2007 3:00:45 PM .
</p>
<p>
Hopefully these features will come in handy. As always, your feedback is welcome, keep the requests/suggestions coming!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.epiphantastic.com/2007/05/12/cfjson-18-is-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JSON schemas/validation with CFJSON</title>
		<link>http://www.epiphantastic.com/2007/03/25/json-schemas-and-validation-with-cfjson/</link>
		<comments>http://www.epiphantastic.com/2007/03/25/json-schemas-and-validation-with-cfjson/#comments</comments>
		<pubDate>Sun, 25 Mar 2007 22:12:00 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[CFJSON]]></category>
		<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://www.epiphantastic.com/?p=22</guid>
		<description><![CDATA[I&#8217;ve made it no secret that I&#8217;m not a fan of XML. However, one of the advantages of XML that is constantly brought up is the ability to validate XML documentes using an XML Schema or DTD. I haven&#8217;t had much use for them myself, but seeing as many people consider this important, I figured [...]]]></description>
			<content:encoded><![CDATA[<p>
I&#8217;ve made it no secret that I&#8217;m not a fan of XML. However, one of the advantages of XML that is constantly brought up is the ability to validate XML documentes using an XML Schema or DTD. I haven&#8217;t had much use for them myself, but seeing as many people consider this important, I figured there was no reason the same couldn&#8217;t be done in JSON. So I came up with a format for a JSON schema file (written in JSON, of course) and added a function to the <a href="cfjson/">CFJSON library</a> to validate a JSON document based on a schema.
</p>
<p>
While I don&#8217;t have docs written for this, it&#8217;s pretty self-explanatory. Here&#8217;s an example of a schema that shows pretty much all the features I&#8217;ve put in it so far:</p>
<pre>
{
   type: "struct",
   keys: ["title","body","categories","start_date","active"],
   items: {
      title: {
         type: "string", maxlength: 20, minlength: 8
      },
      body: {
         type: "string", minlength: 1
      },
      categories: {
         type: "array",
         minlength: 1,
         maxlength: 4,
         items: {
            type: "struct",
            items: {
               id: {
                  type: "number", min:6, max:10
               },
               name: {
                  type: "string"
               }
            }
         }
      },
      start_date: {
         type: "date", mask: "mm-dd-yyyy"
      },
      active: {
         type: "boolean"
      }
   }
}
</pre>
</p>
<p>
In a nutshell, your schema is always an object/struct and it must always have a &#8220;type&#8221; key set. Then you go on nesting more definitions under the &#8220;items&#8221; key if you have more complex data types like structs or arrays. The valid types right now are &#8220;struct&#8221;, &#8220;array&#8221;, &#8220;date&#8221;, &#8220;number&#8221;, &#8220;boolean&#8221;, and &#8220;string&#8221;. Each of these data types have some additional options, which are explained below.
</p>
<p>
<strong>struct</strong><br />
For a type &#8220;struct, you have two additional keys you can add. The first is &#8220;keys&#8221;, in which you can provide an array of the keys that this structure MUST have. The second is &#8220;items&#8221;, which is a structure with keys for each structure key you want to add validation rules for. The &#8220;keys&#8221; and &#8220;items&#8221; values are both optional. You can specify an array of keys without providing &#8220;items&#8221; and vice-versa.
</p>
<p>
<strong>array</strong><br />
An &#8220;array&#8221; type can take 3 additional parameters, &#8220;minlength&#8221;, &#8220;maxlength&#8221;, and &#8220;items&#8221;. The first two are pretty self-explanatory, they check for a certain array length. The last is similar to the &#8220;struct&#8221; type&#8217;s &#8220;items&#8221; key, except inside that structure you do not list validation individually for keys since arrays are just numeric. So you simply put in the structure you want for all the items in the array.
</p>
<p>
<strong>date</strong><br />
The only option for the &#8220;date&#8221; struck type is &#8220;mask&#8221;. In it you can specify a date mask that you want the date to conform to. The possible masks are the same as the ones used by ColdFusion&#8217;s DateFormat function, although this could change because JSON is a universal format not restricted to CF.
</p>
<p>
<strong>number</strong><br />
A &#8220;number&#8221; type provides additional options of &#8220;min&#8221; and &#8220;max&#8221;, which allows you to specify minimum and maximum values for a number. Note that right now the &#8220;number&#8221; type allows for floats too, this will eventually be updated to allow for validating for integers, floats, unsigned numbers, etc.
</p>
<p>
<strong>boolean</strong><br />
The boolean type has no additonal options, although eventually it&#8217;ll probably allow for choosing what can be considered a valid boolean.
</p>
<p>
<strong>string</strong><br />
The &#8220;string&#8221; type can specify a &#8220;maxlength&#8221; and &#8220;minlength&#8221; option that will make sure the string is not longer or shorter than the values specified. Note that the &#8220;string&#8221; type will actually accept booleans and numbers. Right now I&#8217;m not seeing a way around it given the way I implemented things, and I&#8217;m not sure it&#8217;s really a big deal.
</p>
<p>
After defining the JSON schema standard I added a validate() function to CFJSON that validates a JSON document based on a schema conforming to the format described above. I also made a small example, creating a JSON document that conforms to the schema above and running the validate function against it. There&#8217;s a link to download the example below, all you have to do is change some values in the document or in the schema to see the validation working. There are a few more options that are probably easy to figure out looking at the code, such as the &#8220;errorVar&#8221; and &#8220;stopOnError&#8221; arguments. If anybody has any feedback on this I&#8217;d love to hear it.
</p>
<p>
<a href="cfjson/downloads/schema_example.zip">DOWNLOAD CFJSON DOCUMENT VALIDATION EXAMPLE (includes the latest CFJSON)</a><br />
<a href="cfjson/">FIND OUT MORE ABOUT CFJSON</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.epiphantastic.com/2007/03/25/json-schemas-and-validation-with-cfjson/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>CFJSON version 1.7</title>
		<link>http://www.epiphantastic.com/2007/03/02/cfjson-version-17/</link>
		<comments>http://www.epiphantastic.com/2007/03/02/cfjson-version-17/#comments</comments>
		<pubDate>Sat, 03 Mar 2007 00:50:59 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[CFJSON]]></category>
		<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://www.epiphantastic.com/?p=19</guid>
		<description><![CDATA[Today I had some free time and decided to implement some bug fixes for CFJSON. Many thanks to Larry Reinhard who not only provided many fixes but actually built a unit test for them. Wow! That makes my work that much easier! Steve Nelson also contributed and I thank him for that. After implementing Larry&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>
Today I had some free time and decided to implement some bug fixes for CFJSON. Many thanks to Larry Reinhard who not only provided many fixes but actually built a unit test for them. Wow! That makes my work that much easier! Steve Nelson also contributed and I thank him for that.
</p>
<p>
After implementing Larry&#8217;s changes I so happened to read a post on <a href="http://www.bennadel.com">Ben Nadel&#8217;s blog</a> about a problem with a JSON string that had a carriage return. This incited me to go and check if special characters were properly handled, and I discovered that while they were as far as encoding, the decoding was not correct. In the process of fixing this I discovered a serious bug that caused errors when there was one double-quote in a string within a complex data type. I tracked it down to an inexplicable problem with a loop, whereby I incremented the loop&#8217;s index value to essentially skip an iteration, but for whatever reason on the next iteration the value of the index was reset to the original value it would have had if I hadn&#8217;t incremented it. Mystery&#8230; I just changed the loop to a conditional loop where I incremented values myself and that solved my problem.
</p>
<p>
So given the bugs mentioned above, this version of CFJSON is a must download. Hopefully there won&#8217;t be too many serious problems from now on, the transition from one owner to the next and implementation of accumulated code/bug fixes/features made it so some unpleasant stuff crept in, but it&#8217;s looking under control now. Thanks again to all the contributors!
</p>
<p>
<a href="http://www.epiphantastic.com/cfjson/downloads/cfjson-1.7.zip">DOWNLOAD CFJSON v1.7</a><br />
<a href="http://www.epiphantastic.com/cfjson/">GO TO THE CFJSON SITE</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.epiphantastic.com/2007/03/02/cfjson-version-17/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Another CFJSON patch</title>
		<link>http://www.epiphantastic.com/2007/02/13/another-cfjson-patch/</link>
		<comments>http://www.epiphantastic.com/2007/02/13/another-cfjson-patch/#comments</comments>
		<pubDate>Tue, 13 Feb 2007 12:53:54 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[CFJSON]]></category>
		<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://www.epiphantastic.com/?p=16</guid>
		<description><![CDATA[John Farrar reported that CFJSON was outputing a lot of whitespace and needed output=&#8221;no&#8221; added to the functions. I can&#8217;t believe I forgot about that, it&#8217;s quite pathetic&#8230; But it&#8217;s there now in the latest patch, version 1.6c, download away on the CFJSON site!]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sosensible.com/index.cfm/blog/">John Farrar</a> reported that CFJSON was outputing a lot of whitespace and needed output=&#8221;no&#8221; added to the functions. I can&#8217;t believe I forgot about that, it&#8217;s quite pathetic&#8230; But it&#8217;s there now in the latest patch, version 1.6c, download away on the <a href="http://www.epiphantastic.com/cfjson">CFJSON site</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.epiphantastic.com/2007/02/13/another-cfjson-patch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CFJSON patches</title>
		<link>http://www.epiphantastic.com/2007/02/09/cfjson-patches/</link>
		<comments>http://www.epiphantastic.com/2007/02/09/cfjson-patches/#comments</comments>
		<pubDate>Fri, 09 Feb 2007 15:07:23 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[CFJSON]]></category>
		<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://www.epiphantastic.com/?p=15</guid>
		<description><![CDATA[I&#8217;ve made a few small changes to CFJSON yesterday and today to accomodate some requests. The patches are small but useful. I will try to document the less obvious features, like the recently added &#8220;queryKeyCase&#8221; and &#8220;queryFormat&#8221; arguments of the encode() method. They&#8217;re not make-it-or-break it functionality, but they could come in handy. If you [...]]]></description>
			<content:encoded><![CDATA[<p>
I&#8217;ve made a few small changes to <a href="http://www.epiphantastic.com/cfjson/">CFJSON</a> yesterday and today to accomodate some requests. The patches are small but useful. I will try to document the less obvious features, like the recently added &#8220;queryKeyCase&#8221; and &#8220;queryFormat&#8221; arguments of the encode() method. They&#8217;re not make-it-or-break it functionality, but they could come in handy. If you don&#8217;t want to wait for docs, it&#8217;s easy to figure them out just by looking at the code.
</p>
<p>
<a href="http://www.epiphantastic.com/cfjson/">CHECK OUT CFJSON HERE</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.epiphantastic.com/2007/02/09/cfjson-patches/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New version of CFJSON</title>
		<link>http://www.epiphantastic.com/2007/02/04/new-version-of-cfjson/</link>
		<comments>http://www.epiphantastic.com/2007/02/04/new-version-of-cfjson/#comments</comments>
		<pubDate>Mon, 05 Feb 2007 01:59:56 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[CFJSON]]></category>
		<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://www.epiphantastic.com/?p=14</guid>
		<description><![CDATA[I&#8217;ve taken over maintenance of the CFJSON project from Jehiah Czebotar. Took me rather long to get a web site setup for it, but better late than never. To celebrate the unveiling of the site, there&#8217;s a new version out, version 1.6, which brings a long a few bug fixes and enhancement. Hopefully I didn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>
I&#8217;ve taken over maintenance of the <a href="cfjson/">CFJSON project</a> from <a href="http://jehiah.cz">Jehiah Czebotar</a>. Took me rather long to get a web site setup for it, but better late than never. To celebrate the unveiling of the site, there&#8217;s a new version out, version 1.6, which brings a long a few bug fixes and enhancement. Hopefully I didn&#8217;t mess anything up with the old code, given that I pieced together a bunch of changes submitted by some people along with my own.
</p>
<p>
<a href="cfjson/downloads/cfjson-1.6.zip">Click here to download version 1.6 of CFJSON</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.epiphantastic.com/2007/02/04/new-version-of-cfjson/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

