DISQUS

toxicsoftware.com: CocoaJSON

  • Blake Seely · 3 years ago
    You can never have too much code :) I have to credit Buzz for the idea, though - and he mentioned that he got some code started, too. Can't wait to check yours out - I'm definitely curious to see how others are handling a few things I had questions about!
  • David · 3 years ago
    I've been looking at using JSON as well but it appears some data just isn't represented well with Cocoa data structures such as multidimensional arrays.. I'm using QuickLite to get an NSArray of values for each dimension and then simply enumerating through the array to get each integer value and outputting it to a space delimited text file which is uploaded to the server. Javascript on the server then reads the values from the text file to create the multidimensional array.. There has to be a cleaner way then what I am doing.
  • Blake Seely · 3 years ago
    Not sure what you mean about JSON not handling multidimensional arrays? Did a few quick tests, and both the CocoaJSON code, and my own code outputs it just fine - but maybe you're question isn't whether it can handle multidimensional arrays, but whether it's easy?
  • David · 3 years ago
    Yes.. I know JSON handles it fine.. but making multidimensional arrays in Cocoa using NSArray's is very convoluted when looking at the code to create one... Perhaps I'm being too picky :)
  • Jonathan Wight · 3 years ago
    Well feel free to create your own multiple array object in Objective-C then just provide a serialiser/deserialiser methods for them. Not sure if I made my code extensible in this way - but should be easy to add in.
  • Jim · 2 years ago
    Maybe I'm being incredibly stupid, but these classes seem to choke on whitespace. The code isn't capable of parsing something simple like:

    {
    "firstName": "Jim",
    "lastName": "Morrison"
    }

    I thought the culprit might be NSScanner_Extensions skipWhitespace. Surely this should be using whitespaceAndNewlineCharacterSet instead of whitespaceCharacterSet?

    So, I tried changing it. This got the scanner a couple of characters further but it still bails out at the first opportunity. I had a look at the unit tests to see whether they would prove my suspicions wrong. They only served to confirm them, though: all unit tests test against single-line input.

    Am I expecting too much? Am I missing something?
  • schwa · 2 years ago
    Hey Mr Mojo,

    It _should_ work, so you could be doing something braindead. Or it could just be buggy. I'm not doing any work on CocoaJSON right now so feel free to fix it and send me a patch :-)

    Otherwise I'll add to the list of things I need to do. I really need a public facing bug tracker.

    Cheers.

    Jon.
  • Ian · 2 years ago
    Under what license are you publishing this? I see no mention of a license in any of your files.

    Thanks!
  • rob · 2 years ago
    Neither the link to the zip or the link work anymore. Is this still available?
  • schwa · 2 years ago
    See /subversion-moved/
  • ThomasW · 3 weeks ago
    When I click the 'some code' link I get "Repository access denied."
  • schwa · 3 weeks ago
    This code has been made redundant by:

    http://code.google.com/p/touchcode/wiki/TouchJSON