|
@@ -359,14 +359,18 @@ BOOL FLEXConstructorsShouldRun() {
|
|
|
|
|
|
|
|
id jsonObject = [NSJSONSerialization JSONObjectWithData:data options:0 error:NULL];
|
|
id jsonObject = [NSJSONSerialization JSONObjectWithData:data options:0 error:NULL];
|
|
|
if ([NSJSONSerialization isValidJSONObject:jsonObject]) {
|
|
if ([NSJSONSerialization isValidJSONObject:jsonObject]) {
|
|
|
- prettyString = [NSString stringWithCString:[NSJSONSerialization
|
|
|
|
|
- dataWithJSONObject:jsonObject options:NSJSONWritingPrettyPrinted error:NULL
|
|
|
|
|
- ].bytes encoding:NSUTF8StringEncoding];
|
|
|
|
|
|
|
+ // Thanks RaziPour1993
|
|
|
|
|
+ prettyString = [[NSString alloc]
|
|
|
|
|
+ initWithData:[NSJSONSerialization
|
|
|
|
|
+ dataWithJSONObject:jsonObject options:NSJSONWritingPrettyPrinted error:NULL
|
|
|
|
|
+ ]
|
|
|
|
|
+ encoding:NSUTF8StringEncoding
|
|
|
|
|
+ ];
|
|
|
// NSJSONSerialization escapes forward slashes.
|
|
// NSJSONSerialization escapes forward slashes.
|
|
|
// We want pretty json, so run through and unescape the slashes.
|
|
// We want pretty json, so run through and unescape the slashes.
|
|
|
prettyString = [prettyString stringByReplacingOccurrencesOfString:@"\\/" withString:@"/"];
|
|
prettyString = [prettyString stringByReplacingOccurrencesOfString:@"\\/" withString:@"/"];
|
|
|
} else {
|
|
} else {
|
|
|
- prettyString = [NSString stringWithCString:data.bytes encoding:NSUTF8StringEncoding];
|
|
|
|
|
|
|
+ prettyString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return prettyString;
|
|
return prettyString;
|