Skip to content

Commit

Permalink
Merge pull request #129 from fesor/master
Browse files Browse the repository at this point in the history
Fixed quotes unescaping for non string values
  • Loading branch information
bobeast committed Dec 3, 2013
2 parents bad78b8 + e71da3d commit 4487e9e
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/ios/PushPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,16 @@ -(void)parseDictionary:(NSDictionary *)inDictionary intoJSON:(NSMutableString *)

if ([thisObject isKindOfClass:[NSDictionary class]])
[self parseDictionary:thisObject intoJSON:jsonString];
else
[jsonString appendFormat:@"\"%@\":\"%@\",",
key,
[[[[inDictionary objectForKey:key]
stringByReplacingOccurrencesOfString:@"\\" withString:@"\\\\"]
stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""]
stringByReplacingOccurrencesOfString:@"\n" withString:@"\\n"]];
else if ([thisObject isKindOfClass:[NSString class]])
[jsonString appendFormat:@"\"%@\":\"%@\",",
key,
[[[[inDictionary objectForKey:key]
stringByReplacingOccurrencesOfString:@"\\" withString:@"\\\\"]
stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""]
stringByReplacingOccurrencesOfString:@"\n" withString:@"\\n"]];
else {
[jsonString appendFormat:@"\"%@\":\"%@\",", key, [inDictionary objectForKey:key]];
}
}
}

Expand Down

0 comments on commit 4487e9e

Please sign in to comment.