Coder Social home page Coder Social logo

touchjson's People

Contributors

0xced avatar ddustin avatar fbzhong avatar ishaq avatar joericioppo avatar larrycao avatar maafy6 avatar mattjgalloway avatar rayh avatar schwa avatar sync avatar tigerbears avatar vfn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

touchjson's Issues

problem with '\n' when encoding from NSDictionnary to Json

Hi there,

first of all, thank you so much for your wonderful and very useful tool.
I'm getting a weird error though.
I'm encoding a dictionnary to send something to a server.
Let say I have a NSDictionnary with 1key/value :
"message" : "\n test"
When I send this message to the server, I get a 400 error code. When analysing the request sent to the server, it seems like the '\n' is not treated well by the function [CJSONSerializer serializer] serializeObject:], the dictionnary mentionned earlier is serialized into this :
"messaget":"
test"

Do you have any idea why ?

README simple doc fix

--- a/README.markdown
+++ b/README.markdown
@@ -124,7 +124,7 @@ Here is a code sample:
 
        NSDictionary *dictionary = [NSDictionary dictionaryWithObject:@"b" forKey:@"a"];
        NSError *error = NULL;
-       NSData *jsonData = [[CJSONSerializer serializer] serializeObject:dictionary error&error];
+       NSData *jsonData = [[CJSONSerializer serializer] serializeObject:dictionary error:&error];
 
 ## Invalid JSON

Xcode warning fix.

The latest Xcode can now warn about a few more type incompatibilities. This fixes some warnings in TouchJSON:

diff --git a/Source/JSON/CJSONScanner.m b/Source/JSON/CJSONScanner.m
index c5ffeb4..1e4eb41 100644
--- a/Source/JSON/CJSONScanner.m
+++ b/Source/JSON/CJSONScanner.m
@@ -37,7 +37,7 @@

 NSString *const kJSONScannerErrorDomain = @"kJSONScannerErrorDomain";

-inline static int HexToInt(char inCharacter)
+inline static int HexToInt(unichar inCharacter)
     {
     int theValues[] = { 0x0 /* 48 '0' */, 0x1 /* 49 '1' */, 0x2 /* 50 '2' */, 0x3 /* 51 '3' */, 0x4 /* 52 '4' */, 0x5 /* 53 '5' */, 0x6 /* 54 '6' */, 0x7 /* 55 '7' */, 0x8 /* 56 '8' */, 0x9 /* 57 '9' */, -1 /* 58 ':' */, -1 /* 59 ';' */, -1 /* 60 '<' */, -1 /* 61 '=' */, -1 /* 62 '>' */, -1 /* 63 '?' */, -1 /* 64 '@' */, 0xa /* 65 'A' */, 0xb /* 66 'B' */, 0xc /* 67 'C' */, 0xd /* 68 'D' */, 0xe /* 69 'E' */, 0xf /* 70 'F' */, -1 /* 71 'G' */, -1 /* 72 'H' */, -1 /* 73 'I' */, -1 /* 74 'J' */, -1 /* 75 'K' */, -1 /* 76 'L' */, -1 /* 77 'M' */, -1 /* 78 'N' */, -1 /* 79 'O' */, -1 /* 80 'P' */, -1 /* 81 'Q' */, -1 /* 82 'R' */, -1 /* 83 'S' */, -1 /* 84 'T' */, -1 /* 85 'U' */, -1 /* 86 'V' */, -1 /* 87 'W' */, -1 /* 88 'X' */, -1 /* 89 'Y' */, -1 /* 90 'Z' */, -1 /* 91 '[' */, -1 /* 92 '\' */, -1 /* 93 ']' */, -1 /* 94 '^' */, -1 /* 95 '_' */, -1 /* 96 '`' */, 0xa /* 97 'a' */, 0xb /* 98 'b' */, 0xc /* 99 'c' */, 0xd /* 100 'd' */, 0xe /* 101 'e' */, 0xf /* 102 'f' */, };
     if (inCharacter >= '0' && inCharacter <= 'f')

Escaping symbols

CJSONDeserializer returns error

kJSONScannerErrorCode_DictionaryKeyValueNoDelimiter

when trying to deserialize

{
    "key": "\\\""
}

When deserializing with space between escaped symbols

{
    "key": "\\ \""
}

everything works

FYI: License/Copyright in Source Headers doesn't Match License on homepage

FYI: Your License and Copyright in your Source Headers doesn't Match License on homepage.

I'll use the license terms on the project page since it's more restrictive, but I thought I'd give you a heads up. It looks like you are MIT in your headers, but you have the 2-clause BSD in your project.

from most of the *.h files:
// Created by Jonathan Wight on 04/16/08.
// Copyright 2008 toxicsoftware.com. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.

...Not a big deal, I just want to get the attribution right for you when we start distributing our app that uses your stuff.

CJSONSerializer returns NSData that can't be converted to NSString

In some cases data returned from CJSONSerializer can't be converted to an NSString without losing some or all of the JSON data. I ran into this with the included test data file "twitter_public_timeline.json", which contains CJK characters. I deserialized the file using CJSONDeserializer and then re-serialized via CJSONSerializer. [Why? Because I have a slightly hacked CJSONSerializer that can produce more human-readable output. But the problem exists even on the stock CJSONSerializer.]

Somewhat simplified code (the full version is in https://github.com/atomicbird/jsonlint)

NSData *inputData = [NSData dataWithContentsOfFile:@"twitter_public_timeline.json"];
id json = [[CJSONDeserializer deserializer] deserialize:inputData error:nil]
NSData *jsonData = [[CJSONSerializer serializer] serializeObject:json error:nil];
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];

At this point jsonData contains what looks like good JSON, but jsonString is nil. If I write jsonData to a file it contains UTF-8 encodings of the CJK characters.

If I then run jsonData back into CJSONDeserializer, I get an error message reading "Could not scan data. Data wasn't encoded properly?", from CJSONScanner:

NSError *deserializeError = nil;
id json2 = [[CJSONDeserializer deserializer] deserialize:jsonData error:&deserializeError];

This looks to be because CJSONScanner is doing more or less the same thing I was doing above, attempting to create an NSString and specifying UTF8.

"Did not consume all data" error when deserializing JSON which has null value.

Hi.
I've been using CJSONDeserializer without any problems for a long time.
But the latest commit (bfffb73) makes it impossible to parse JSON which has null value when the nullObject property is set to NULL.
It causes "Did not consume all data" error and produces nil.
Could you check this problem?
Here's the part of JSON that I failed to deserialize.

user = {
age = 26;
bio = "";
birthday = "1988-02-28";
}

Failing to run on IOS 3.1.2

Hi,

Am using
[[CJSONDeserializer deserializer] deserializeAsDictionary:jsonData error:&error]];

The code and decode run fine on iOS 4. (no issues there)

But on iOS 3.1.2, I get the following error

dyld: lazy symbol binding failed: Symbol not found: _dispatch_once
Referenced from: /var/mobile/Applications/C2DD12ED-9497-4CF8-955D-0510FA76DCB5/iCric2.app/iCric2
Expected in: /usr/lib/libSystem.B.dylib

I know I am supposed to weak link something or change a setting somewhere. Just cannot figure out what.

Base SDK 4.2
iOS deployment target - iOS 3.1.2
Mac OS X deployment target - Mac OS 10.5
weak link to MessageUI
Your help is appreciated.

Fail to parse valid JSON on iPod Touch 1G running iOS 3.1.3

Just updated from old TouchJSON version (don't know exactly which one) to latest source.
I had to do an update, because TouchJSON kept crashing while parsing JSON data with following message
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[NSCFString appendString:]: nil argument'
I found that this is Issue 82 and recommendation is to use latest code, so I switched to latest.

The issue now is that valid JSON is not parsed.
The error is (NSError after call to deserialize or deserializeAsDictionary):
Error Domain=kJSONScannerErrorDomain Code=-12 UserInfo=0x1c44d0 "Could not scan data. Data wasn't encoded properly?"
Before I paste lengthy JSON data here, I have to mention that this error happens only on device (iPod Touch 1G) running iOS 3.1.3
iOS 4.2 Simulator and iPad running iOS 4.3.2 both have no issues with parsing similar JSONs sent by same server (the structure of JSON is same, but some values are different, like names and ids).

The JSON data in question is:
{
"result": {
"games": [
{
"gameId": 68052,
"creationDate": "Tue May 10 15:26:48 UTC 2011",
"name": "i4niaccc",
"state": 1,
"lastCmdPlayerType": 1,
"lastMoveUnitId": -1,
"lastMoveToRow": -1,
"lastMoveToCol": -1,
"lastCmd": 8,
"lastCoinToss": -1,
"serverPlayer": {
"left": false,
"id": "040e5d67ec2042700e73f5b4baf1e6cc2cf85c0f",
"name": "i4niaccc",
"rank": "0",
"osType": "iOS_2.1",
"tag": "8dfd0400dba5beb5fe37b8e05b2209f2c87b22ab598c954d2168a46d1777d521",
"setupDone": false,
"army": null,
"prevArmy": null,
"result": -100,
"revealedUnits": null
},
"clientPlayer": {
"left": false,
"id": "040e5d67ec2042700e73f5b4baf1e6cc2cf85c0f",
"name": "i4niaccc",
"rank": "0",
"osType": "iOS_2.1",
"tag": "8dfd0400dba5beb5fe37b8e05b2209f2c87b22ab598c954d2168a46d1777d521",
"setupDone": false,
"army": null,
"prevArmy": null,
"result": -100,
"revealedUnits": null
},
"rules": {
"defenderMovedOnWin": false,
"marshallProtected": true,
"bombRemoved": false,
"rangeAttack": true,
"attackerWinsOnTie": false,
"chasing": false,
"jumping": false,
"revealUnits": false,
"markMovedUnits": false
}
},
{
"gameId": 66049,
"creationDate": "Tue May 10 15:32:38 UTC 2011",
"name": "i4niaccc",
"state": 0,
"lastCmdPlayerType": 1,
"lastMoveUnitId": -1,
"lastMoveToRow": -1,
"lastMoveToCol": -1,
"lastCmd": 8,
"lastCoinToss": -1,
"serverPlayer": {
"left": false,
"id": "040e5d67ec2042700e73f5b4baf1e6cc2cf85c0f",
"name": "i4niaccc",
"rank": "0",
"osType": "iOS_2.1",
"tag": "8dfd0400dba5beb5fe37b8e05b2209f2c87b22ab598c954d2168a46d1777d521",
"setupDone": false,
"army": null,
"prevArmy": null,
"result": -100,
"revealedUnits": null
},
"clientPlayer": {
"left": false,
"id": null,
"name": null,
"rank": null,
"osType": null,
"tag": null,
"setupDone": false,
"army": null,
"prevArmy": null,
"result": 0,
"revealedUnits": null
},
"rules": {
"defenderMovedOnWin": false,
"marshallProtected": true,
"bombRemoved": false,
"rangeAttack": false,
"attackerWinsOnTie": false,
"chasing": false,
"jumping": false,
"revealUnits": false,
"markMovedUnits": false
}
},
{
"gameId": 66050,
"creationDate": "Tue May 10 15:43:09 UTC 2011",
"name": "i4niaccc",
"state": 0,
"lastCmdPlayerType": 1,
"lastMoveUnitId": -1,
"lastMoveToRow": -1,
"lastMoveToCol": -1,
"lastCmd": 8,
"lastCoinToss": -1,
"serverPlayer": {
"left": false,
"id": "040e5d67ec2042700e73f5b4baf1e6cc2cf85c0f",
"name": "i4niaccc",
"rank": "0",
"osType": "iOS_2.1",
"tag": "8dfd0400dba5beb5fe37b8e05b2209f2c87b22ab598c954d2168a46d1777d521",
"setupDone": false,
"army": null,
"prevArmy": null,
"result": -100,
"revealedUnits": null
},
"clientPlayer": {
"left": false,
"id": null,
"name": null,
"rank": null,
"osType": null,
"tag": null,
"setupDone": false,
"army": null,
"prevArmy": null,
"result": 0,
"revealedUnits": null
},
"rules": {
"defenderMovedOnWin": false,
"marshallProtected": false,
"bombRemoved": true,
"rangeAttack": false,
"attackerWinsOnTie": false,
"chasing": false,
"jumping": false,
"revealUnits": false,
"markMovedUnits": false
}
},
{
"gameId": 69059,
"creationDate": "Tue May 10 15:50:54 UTC 2011",
"name": "i4niaccc",
"state": 0,
"lastCmdPlayerType": 1,
"lastMoveUnitId": -1,
"lastMoveToRow": -1,
"lastMoveToCol": -1,
"lastCmd": 8,
"lastCoinToss": -1,
"serverPlayer": {
"left": false,
"id": "040e5d67ec2042700e73f5b4baf1e6cc2cf85c0f",
"name": "i4niaccc",
"rank": "0",
"osType": "iOS_2.1",
"tag": "8dfd0400dba5beb5fe37b8e05b2209f2c87b22ab598c954d2168a46d1777d521",
"setupDone": false,
"army": null,
"prevArmy": null,
"result": -100,
"revealedUnits": null
},
"clientPlayer": {
"left": false,
"id": null,
"name": null,
"rank": null,
"osType": null,
"tag": null,
"setupDone": false,
"army": null,
"prevArmy": null,
"result": 0,
"revealedUnits": null
},
"rules": {
"defenderMovedOnWin": false,
"marshallProtected": false,
"bombRemoved": false,
"rangeAttack": true,
"attackerWinsOnTie": false,
"chasing": false,
"jumping": false,
"revealUnits": false,
"markMovedUnits": false
}
},
{
"gameId": 70054,
"creationDate": "Tue May 10 15:52:44 UTC 2011",
"name": "i4niaccc",
"state": 0,
"lastCmdPlayerType": 1,
"lastMoveUnitId": -1,
"lastMoveToRow": -1,
"lastMoveToCol": -1,
"lastCmd": 8,
"lastCoinToss": -1,
"serverPlayer": {
"left": false,
"id": "040e5d67ec2042700e73f5b4baf1e6cc2cf85c0f",
"name": "i4niaccc",
"rank": "0",
"osType": "iOS_2.1",
"tag": "8dfd0400dba5beb5fe37b8e05b2209f2c87b22ab598c954d2168a46d1777d521",
"setupDone": false,
"army": null,
"prevArmy": null,
"result": -100,
"revealedUnits": null
},
"clientPlayer": {
"left": false,
"id": null,
"name": null,
"rank": null,
"osType": null,
"tag": null,
"setupDone": false,
"army": null,
"prevArmy": null,
"result": 0,
"revealedUnits": null
},
"rules": {
"defenderMovedOnWin": false,
"marshallProtected": true,
"bombRemoved": false,
"rangeAttack": true,
"attackerWinsOnTie": false,
"chasing": false,
"jumping": false,
"revealUnits": false,
"markMovedUnits": false
}
},
{
"gameId": 69044,
"creationDate": "Mon May 09 16:48:23 UTC 2011",
"name": "DuoPackLeader",
"state": 1,
"lastCmdPlayerType": 1,
"lastMoveUnitId": -1,
"lastMoveToRow": -1,
"lastMoveToCol": -1,
"lastCmd": 3,
"lastCoinToss": -1,
"serverPlayer": {
"left": false,
"id": "G:402633397",
"name": "DuoPackLeader",
"rank": "4",
"osType": "iOS",
"tag": "9c4f77aaebd4618453e8ae3c321b8230e8d87944e9989a33f043af586b233063",
"setupDone": true,
"army": "0,0,6;1,0,5;2,0,7;3,1,0;4,1,6;5,1,9;6,2,3;7,3,3;8,1,5;9,1,7;10,2,6;11,2,7;12,3,0;13,3,5;14,3,7;15,3,8;16,0,2;17,0,4;18,0,8;19,2,2;20,3,6;21,0,0;22,0,3;23,0,9;24,1,3;25,0,1;26,3,1;27,3,4;28,3,9;29,1,2;30,2,0;31,2,5;32,2,8;33,1,1;34,1,4;35,1,8;36,2,1;37,3,2;38,2,4;39,2,9",
"prevArmy": "0,0,6;1,0,5;2,0,7;3,1,0;4,1,6;5,1,9;6,2,3;7,3,3;8,1,5;9,1,7;10,2,6;11,2,7;12,3,0;13,3,5;14,3,7;15,3,8;16,0,2;17,0,4;18,0,8;19,2,2;20,3,6;21,0,0;22,0,3;23,0,9;24,1,3;25,0,1;26,3,1;27,3,4;28,3,9;29,1,2;30,2,0;31,2,5;32,2,8;33,1,1;34,1,4;35,1,8;36,2,1;37,3,2;38,2,4;39,2,9",
"result": -100,
"revealedUnits": "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0"
},
"clientPlayer": {
"left": false,
"id": "040e5d67ec2042700e73f5b4baf1e6cc2cf85c0f",
"name": "i4niac",
"rank": "0",
"osType": "iOS_2.1",
"tag": "8dfd0400dba5beb5fe37b8e05b2209f2c87b22ab598c954d2168a46d1777d521",
"setupDone": false,
"army": null,
"prevArmy": null,
"result": -100,
"revealedUnits": null
},
"rules": {
"defenderMovedOnWin": false,
"marshallProtected": true,
"bombRemoved": false,
"rangeAttack": false,
"attackerWinsOnTie": false,
"chasing": false,
"jumping": false,
"revealUnits": false,
"markMovedUnits": false
}
},
{
"gameId": 74001,
"creationDate": "Mon May 09 17:05:14 UTC 2011",
"name": "Battyboy99",
"state": 1,
"lastCmdPlayerType": -1,
"lastMoveUnitId": -1,
"lastMoveToRow": -1,
"lastMoveToCol": -1,
"lastCmd": 0,
"lastCoinToss": -1,
"serverPlayer": {
"left": false,
"id": "G:402122695",
"name": "Battyboy99",
"rank": "0",
"osType": "iOS",
"tag": "3801e47c3283a8a6b96c880232b39e90760a1f213f494d3ad741c30f4bcb715c",
"setupDone": false,
"army": null,
"prevArmy": null,
"result": -100,
"revealedUnits": null
},
"clientPlayer": {
"left": false,
"id": "040e5d67ec2042700e73f5b4baf1e6cc2cf85c0f",
"name": "i4niac",
"rank": "0",
"osType": "iOS_2.1",
"tag": "8dfd0400dba5beb5fe37b8e05b2209f2c87b22ab598c954d2168a46d1777d521",
"setupDone": false,
"army": null,
"prevArmy": null,
"result": -100,
"revealedUnits": null
},
"rules": {
"defenderMovedOnWin": false,
"marshallProtected": true,
"bombRemoved": false,
"rangeAttack": false,
"attackerWinsOnTie": false,
"chasing": false,
"jumping": false,
"revealUnits": false,
"markMovedUnits": false
}
},
{
"gameId": 75001,
"creationDate": "Mon May 09 17:05:46 UTC 2011",
"name": "Süner",
"state": 1,
"lastCmdPlayerType": -1,
"lastMoveUnitId": -1,
"lastMoveToRow": -1,
"lastMoveToCol": -1,
"lastCmd": 0,
"lastCoinToss": -1,
"serverPlayer": {
"left": false,
"id": "G:550746163",
"name": "Süner",
"rank": "8",
"osType": "iOS",
"tag": "0338addc91b361d3101bf3c55efede784ab21c9ab7a4ec1858f60ccdd73fa901",
"setupDone": false,
"army": null,
"prevArmy": null,
"result": -100,
"revealedUnits": null
},
"clientPlayer": {
"left": false,
"id": "040e5d67ec2042700e73f5b4baf1e6cc2cf85c0f",
"name": "i4niac",
"rank": "0",
"osType": "iOS_2.1",
"tag": "8dfd0400dba5beb5fe37b8e05b2209f2c87b22ab598c954d2168a46d1777d521",
"setupDone": false,
"army": null,
"prevArmy": null,
"result": -100,
"revealedUnits": null
},
"rules": {
"defenderMovedOnWin": false,
"marshallProtected": true,
"bombRemoved": false,
"rangeAttack": false,
"attackerWinsOnTie": false,
"chasing": false,
"jumping": false,
"revealUnits": false,
"markMovedUnits": false
}
},
{
"gameId": 68052,
"creationDate": "Tue May 10 15:26:48 UTC 2011",
"name": "i4niaccc",
"state": 1,
"lastCmdPlayerType": 1,
"lastMoveUnitId": -1,
"lastMoveToRow": -1,
"lastMoveToCol": -1,
"lastCmd": 8,
"lastCoinToss": -1,
"serverPlayer": {
"left": false,
"id": "040e5d67ec2042700e73f5b4baf1e6cc2cf85c0f",
"name": "i4niaccc",
"rank": "0",
"osType": "iOS_2.1",
"tag": "8dfd0400dba5beb5fe37b8e05b2209f2c87b22ab598c954d2168a46d1777d521",
"setupDone": false,
"army": null,
"prevArmy": null,
"result": -100,
"revealedUnits": null
},
"clientPlayer": {
"left": false,
"id": "040e5d67ec2042700e73f5b4baf1e6cc2cf85c0f",
"name": "i4niaccc",
"rank": "0",
"osType": "iOS_2.1",
"tag": "8dfd0400dba5beb5fe37b8e05b2209f2c87b22ab598c954d2168a46d1777d521",
"setupDone": false,
"army": null,
"prevArmy": null,
"result": -100,
"revealedUnits": null
},
"rules": {
"defenderMovedOnWin": false,
"marshallProtected": true,
"bombRemoved": false,
"rangeAttack": true,
"attackerWinsOnTie": false,
"chasing": false,
"jumping": false,
"revealUnits": false,
"markMovedUnits": false
}
}
],
"status": "success"
}
}

Deserialization does not work for me

Here is my json:
{
"siteinfo": [
{
"title": "My Title",
"address": "My Addres",
"phone1": "(559) 426-4444",
"welcomeMessage": "msg",
"mainLogoUrl": "data:image/png;base64, iVBORw0KG..."
}
]
}

Of course I truncated the base64 data since it is rather large.

Here is my objective c code:
//This was my first attempt, it gave me an error in CJSONScanner.m (theData.Length was null!!!)
//NSData *theJSONData = jsonResult;
//NSError *theError = nil;
//id theObject = [[CJSONDeserializer deserializer] deserialize:theJSONData error:&theError];

//This is my second attempt:

NSString *jsonString = jsonResult;
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
NSError *error = nil;
NSDictionary *dictionary = [[CJSONDeserializer deserializer] deserializeAsDictionary:jsonData error:&error];

In this case no error and data.length equals zero in CJSONScanner.m (which seems wrong) an I cannot see anything in *dictionary -print *dictionary gives me the following:

(gdb) print *dictionary
$1 = {
= {
isa = 0xe4880c
}, }

I have verified my json works fine with a javascript library I use so I am at a loss here. I am suspecting I am misusing your library ???

Thanks for any help in advance,

Joe Ebright

failing to compile in iOS 4.2 project

Not sure if I'm missing a build setting or what, but this is happening in a brand new iOS project with the current code in github

Undefined symbols:
"OBJC_IVAR$_CDataScanner.start", referenced from:
OBJC_IVAR$_CDataScanner.start$non_lazy_ptr in CDataScanner_Extensions.o
(maybe you meant: OBJC_IVAR$_CDataScanner.start$non_lazy_ptr)
"OBJC_IVAR$_CDataScanner.end", referenced from:
OBJC_IVAR$_CDataScanner.end$non_lazy_ptr in CJSONScanner.o
(maybe you meant: OBJC_IVAR$_CDataScanner.end$non_lazy_ptr)
"OBJC_METACLASS$_CDataScanner", referenced from:
OBJC_METACLASS$_CJSONScanner in CJSONScanner.o
"OBJC_CLASS$CDataScanner", referenced from:
l_OBJC
$CATEGORY_CDataScanner$_CDataScanner_Extensions in CDataScanner_Extensions.o
objc-class-ref-to-CDataScanner in CDataScanner_Extensions.o
OBJC_CLASS$_CJSONScanner in CJSONScanner.o
"OBJC_IVAR$_CDataScanner.current", referenced from:
OBJC_IVAR$_CDataScanner.current$non_lazy_ptr in CDataScanner_Extensions.o
OBJC_IVAR$_CDataScanner.current$non_lazy_ptr in CJSONScanner.o
(maybe you meant: OBJC_IVAR$_CDataScanner.current$non_lazy_ptr)
ld: symbol(s) not found
collect2: ld returned 1 exit status

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.