I have recently started parsing JSON documents using SBJSON Parser, and I am able to read JSON documents just fine. However I am unable to figure out how I am meant to write JSON using this library. Under the documentation
http://stig.github.com/json-framework/api/3.0/interfaceSBJsonStreamWriter.html
There is a class for writing JSON, but I cannot figure out how to use it. There are no tutorials in his documentation on how to use it, and I can't find any tutorials online about using it.
As an example, I tried doing something like this
SBJsonStreamWriter *write = [[SBJsonStreamWriter alloc]init];
[write writeObjectOpen];
[write writeString:@"Testing"];
[write writeObjectClose];
But I don't know how to print this out, and I need to be able to write JSON for my project as I will be updating JSON files, so need to understand how to write JSON.
As anyone used this library before to write? If so could you please show me a quick example of how it is done
Thanks in advance!
Note: I can't use the in built JSON Parser released with new xCode as my app must be able to support phones from IOS 4+ and the new Parser won't work on phones that do not have IOS 5 installed
EDIT
Example say I wanted to create a JSON file which consisted of an array of names e.g.
{ "name":[ "Elliot Jacobs", "Paul", "Maria", "Richard", "Ana" ] }
EDIT 2:
Example two
{ "HomeScreen":{ "Title":{ "Name":"James Bond", "Number":"07789 123 456" } } }