title: iOS- Cannot get expected json results back
body: <p>I am trying to use google currency rest api to get USD->GBP convert result.
  something like this-> <a href="http://www.google.com/ig/calculator?hl=en&amp;q=100USD=?GBP" rel="nofollow">http://www.google.com/ig/calculator?hl=en&amp;q=100USD=?GBP</a></p>
  
  <p>the json is response is :<br>
  {lhs: "100 U.S. dollars",rhs: "62.9802242 British pounds",error: "",icc: true}</p>
  
  <p>so i m trying to get the values from "lhs" "rhs" stored into 2 strings</p>
  
  <p>here is my method for fetching converted result data :</p>
  
  <pre><code>@implementation ConvertorBrain
  
  -(id)initWithFromCurrency:(NSString *)fromCurrency
                 toCurrency:(NSString *)toCurrency
                 withAmount:(int)amount
  {
      if (self=[super init]) {
          self.fromCurrency = fromCurrency;
          self.toCurrency = toCurrency;
          self.amount = amount;
      }
      return self;
  }
  
  -(void)getConvertResult
  {
      NSString *encodeFromCurrencyTerm = [self.fromCurrency stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
      NSString *encodeToCurrencyTerm = [self.toCurrency stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
  
      NSString *searchLocation = [NSString stringWithFormat:@"http://www.google.com/ig/calculator?hl=en&amp;q=%d%@=?%@", self.amount, encodeFromCurrencyTerm, encodeToCurrencyTerm];
      NSURL *convertedResults = [NSURL URLWithString:searchLocation];
  
      NSData *JSONData = [[NSData alloc] initWithContentsOfURL:convertedResults];
      if ([JSONData length] &gt; 0) {
          NSError *error = nil;
          NSDictionary *dictoionary = [NSJSONSerialization JSONObjectWithData:JSONData options:0 error:&amp;error];
          if (!dictoionary) {
              NSLog(@"Json parsing failed: %@", error);
          }
  
          self.lhs = [dictoionary valueForKey:@"lhs"];
          self.rhs = [dictoionary valueForKey:@"rhs"];
  
      } else {
          [[[UIAlertView alloc] initWithTitle:@"Service Error" message:@"Cannot complete your request at this time, please try later" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show];
      }
  }
  </code></pre>
  
  <p>then i called method in some other place like this :</p>
  
  <pre><code>self.brain = [[ConvertorBrain alloc] initWithFromCurrency:@"USD" toCurrency:@"GBP" withAmount:100];
  [self.brain getConvertResult];
  </code></pre>
  
  <p>then my expected lhs and rhs results should be lhs= "100 U.S. dollars" rhs ="62.9802242 British pounds"</p>
  
  <p>however, if i run the code, it throw me back these errors:
  Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (No string key for value in object around character 1.) UserInfo=0x7172860 {NSDebugDescription=No string key for value in object around character 1.}</p>
  
  <p>i cannot figure out what has went wrong..need help, 
  also, i tried to debug it a bit. it seems is this line went wrong, dosent get any data somehow -> <code>NSData *JSONData = [[NSData alloc] initWithContentsOfURL:convertedResults];</code></p>