Permalink
Browse files

Wrapped & fixed small typos in README.

  • Loading branch information...
schwa committed Oct 12, 2011
1 parent ded53ca commit b6aa05e492454c67b025a7b20a59ddef345983ec
Showing with 42 additions and 17 deletions.
  1. +42 −17 README.markdown
View
@@ -2,15 +2,17 @@
## Introduction
-TouchJSON is an Objective-C based parser and generator for JSON encoded data. TouchJSON compiles for Mac OS X and iOS devices (currently iPhone, iPad and iPod Touch).
+TouchJSON is an Objective-C based parser and generator for JSON encoded data. TouchJSON compiles for
+Mac OS X and iOS devices (currently iPhone, iPad and iPod Touch).
It is based on Jonathan Wight's CocoaJSON code: <http://toxicsoftware.com/cocoajson/>
TouchJSON is part of the TouchCode "family" of open source software.
## License
-This code is licensed under the 2-clause BSD license ("Simplified BSD License" or "FreeBSD License") license. The license is reproduced below:
+This code is licensed under the 2-clause BSD license ("Simplified BSD License" or "FreeBSD License")
+license. The license is reproduced below:
Copyright 2011 Jonathan Wight. All rights reserved.
@@ -44,7 +46,8 @@ The "master" branch of TouchJSON does NOT use Automatic Reference Counting (ARC)
There is a branch that does use ARC - this is found at "features/ARC".
-Most new development occurs on the ARC branch. At some point the non-ARC branch will put into maintenance mode and the ARC branch will become the primary branch.
+Most new development occurs on the ARC branch. At some point the non-ARC branch will put into
+maintenance mode and the ARC branch will become the primary branch.
## Home
@@ -54,7 +57,9 @@ The main source repository for touchcode is on github at <http://github.com/Touc
## Author
-The primary author is Jonathan Wight <http://toxicsoftware.com/> with several other people contributing bug fixes, patches and documentation. (Note: if you have contributed to TouchJSON and want to be listed here let Jonathan Wight know).
+The primary author is Jonathan Wight <http://toxicsoftware.com/> with several other people
+contributing bug fixes, patches and documentation. (Note: if you have contributed to TouchJSON and
+want to be listed here let Jonathan Wight know).
## What is JSON?
@@ -64,11 +69,15 @@ The primary author is Jonathan Wight <http://toxicsoftware.com/> with several ot
## Support
-There's a relatively low traffic mailing list hosted on Google Groups: <http://groups.google.com/group/touchcode-dev>
+There's a relatively low traffic mailing list hosted on Google Groups:
+<http://groups.google.com/group/touchcode-dev>
## Bug Reporting
-File bugs on the github issue tracker <http://github.com/TouchCode/TouchJSON/issues> but please make sure that your JSON data is valid (see <http://www.jsonlint.com/> before filing bugs (of course if you've found a crash with TouchJSON's handling of invalid JSON feel free to file a bug or discuss on the mailing list).
+File bugs on the github issue tracker <http://github.com/TouchCode/TouchJSON/issues> but please make
+sure that your JSON data is valid (see <http://www.jsonlint.com/> before filing bugs (of course if
+you've found a crash with TouchJSON's handling of invalid JSON feel free to file a bug or discuss on
+the mailing list).
## How to Help
@@ -94,20 +103,24 @@ Click here to lend your support to TouchCode and make a donation:
## How to use TouchJSON in your Cocoa or Cocoa Touch application.
-TouchJSON is incredibly easy to use. Usually you can convert JSON data to and from a Cocoa representation in just a line of code.
+TouchJSON is incredibly easy to use. Usually you can convert JSON data to and from a Cocoa
+representation in just a line of code.
### Dependencies
-None! TouchJSON compiles on Mac OS X (note it does use ObjC-2) and iOS. It should compile on all versions of iOS to date.
+None! TouchJSON compiles on Mac OS X (note it does use ObjC-2) and iOS. It should compile on all
+versions of iOS to date.
Note that the demo, unit tests and bench-marking projects run on Mac OS X.
### Setup your project
Copy the source files within TouchJSON/Source to your project.
-The easiest way is to open both projects in Xcode, then drag and drop. Make sure to check "Copy items into destination groups folder (if needed)."
+The easiest way is to open both projects in Xcode, then drag and drop. Make sure to check "Copy
+items into destination groups folder (if needed)."
-Be aware that the code in the Experimental subdirectory of Source is just that and may not have been extensively tested and/or have extra dependencies
+Be aware that the code in the Experimental subdirectory of Source is just that and may not have been
+extensively tested and/or have extra dependencies
### To transform JSON to objects
@@ -119,14 +132,17 @@ Put #import "CJSONDeserializer.h" in your source file.
NSError *theError = nil;
id theObject = [[CJSONDeserializer deserializer] deserialize:theJSONData error:&theError];}
-This will convert an NSData object containing JSON into an object. The resulting object's class depends on the type of JSON data in question. If the object is NULL then deserialization has failed and you should check the error parameter.
+This will convert an NSData object containing JSON into an object. The resulting object's class
+depends on the type of JSON data in question. If the object is NULL then deserialization has failed
+and you should check the error parameter.
-The following, slightly more complex example shows how to convert an NSString containing a JSON dictionary into an NSDictionary:
+The following, slightly more complex example shows how to convert an NSString containing a JSON
+dictionary into an NSDictionary:
NSString *jsonString = @"yourJSONHere";
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
NSError *error = nil;
- NSDictionary *dictionary = [[CJSONDeserializer deserializer] deserializeAsDictionary:jsonData error:&error];}
+ NSDictionary *dictionary = [[CJSONDeserializer deserializer] deserializeAsDictionary:jsonData error:&error];
This deserialization will fail if the JSON root object is not a dictionary. Again check the error.
@@ -142,7 +158,9 @@ This version of the code could be considered more convenient than the above form
#### Avoiding NSNull values in output.
-If your input JSON data contains null values these values will, by default, be represented by NSNull in your output ObjC objects. The following example shows you how to avoid NSNull values in your output:
+If your input JSON data contains null values these values will, by default, be represented by NSNull
+in your output ObjC objects. The following example shows you how to avoid NSNull values in your
+output:
NSData *theJSONData = /* some JSON data */
CJSONDeserializer *theDeserializer = [CJSONDeserializer deserializer];
@@ -162,14 +180,21 @@ Here is a code sample:
## Invalid JSON
-If you think your JSON is valid but TouchJSON is failing to process it correctly (or if you think TouchJSON is producing invalid JSON) use the online JSON lint tool to validate your JSON: <http://www.jsonlint.com/>
+If you think your JSON is valid but TouchJSON is failing to process it correctly (or if you think
+TouchJSON is producing invalid JSON) use the online JSON lint tool to validate your JSON:
+<http://www.jsonlint.com/>
It is especially important to validate your JSON before filing bugs.
## String encoding
-TouchJSON will work with JSON with any string encoding supported by the Foundation framework. However internally TouchJSON prefers UTF8, so for performance purposes you should try to use UTF8 if at all possible.
+TouchJSON will work with JSON with any string encoding supported by the Foundation framework.
+However internally TouchJSON prefers UTF8, so for performance purposes you should try to use UTF8 if
+at all possible.
## Date Formats
-JSON doesn't specify a date encoding format. As such various methods are used. As such TouchJSON doesn't dictate which format you use. ISO 8601 style dates (with as much precession as needed) are recoemmended. See <http://en.wikipedia.org/wiki/ISO_8601>. You can use the CFilteringJSONSerializer class to automatically serialize Cocoa's NSDate objects into ISO-8601 strings
+JSON doesn't specify a date encoding format. As such various methods are used. As such TouchJSON
+doesn't dictate which format you use. ISO 8601 style dates (with as much precession as needed) are
+recoemmended. See <http://en.wikipedia.org/wiki/ISO_8601>. You can use the CFilteringJSONSerializer
+class to automatically serialize Cocoa's NSDate objects into ISO-8601 strings

0 comments on commit b6aa05e

Please sign in to comment.