0

Is there a way to use TouchXML to parse json in which the key are not quoted, like this:

{ foo:"bar" }

I'm trying to parse the response from a webservice (google), so simply fixing the JSON code to be valid is not an option.

If it's not possible, is there a way to efficiently quote the keys as a preprocessing step?

StaxMan
  • 113,358
  • 34
  • 211
  • 239
sharvey
  • 7,635
  • 7
  • 48
  • 66
  • 1
    While you can't fix it yourself, maybe you could at least file a bug report -- what service produces is not JSON, pure and simple, so if it is advertised as doing that, it is broken. I realize this won't solve your problem on short term but could help others over time. – StaxMan Dec 16 '10 at 18:27

1 Answers1

0

I decided to pre-parse it with RegexKitLite, using

uint numReplace = [encoded replaceOccurrencesOfRegex:@"(?<=[\\{,])[^:\\[\\{\"]+(?=:)" withString:@"\"$0\""];
sharvey
  • 7,635
  • 7
  • 48
  • 66