title: Delphi JsonTextReader fails to read values
body: <p>I have a very weird situation.</p>
  
  <p>This is the JSON I am trying to parse:</p>
  
  <pre class="lang-json prettyprint-override"><code>[
    {
      "username":"xxx",
      "email":"xxx@gmail.com",
      "custom_title":"xxx title",
      "timezone":"Africa\/Cairo",
      "message_count":"218",
      "alerts_unread":"0",
      "like_count":"385",
      "friend_count":"0"
    }
  ]
  </code></pre>
  
  <p>This is my parsing code:</p>
  
  <pre class="lang-pascal prettyprint-override"><code>type
    TUserData = record
      email, timezone: string;
      msg, alerts, likes: integer;
   end;
  
  procedure TDMRest.parseData(var b: TUserData);
  var
    jtr: TJsonTextReader;
    sr: TStringReader;
  begin
    //RESTResponseLogin.Content has the above json text
    sr := TStringReader.Create(RESTResponseLogin.Content);
    try
      jtr := TJsonTextReader.Create(sr);
      try
        while jtr.Read do
        begin
          if jtr.TokenType = TJsonToken.StartObject then
            process(b, jtr);
        end;
      finally
        jtr.Free;
      end;
    finally
      sr.Free;
     end;
  end;
  
  //here there is a problem
  procedure TDMRest.process(var c: TUserData; jtr: TJsonTextReader);
  begin
    while jtr.Read do
    begin
      if (jtr.TokenType = TJsonToken.PropertyName) then
      begin
        if jtr.Value.ToString = 'email' then
        begin
          jtr.Read;
          c.email := jtr.Value.AsString;
        end;
  
        if jtr.Value.ToString = 'timezone' then
        begin
          jtr.Read;
          c.timezone := jtr.Value.AsString;
        end;
  
        if jtr.Value.ToString = 'message_count' then
        begin
          jtr.Read;
          c.msg := jtr.Value.AsInteger;
        end;
  
        if jtr.TokenType = TJsonToken.EndObject then
        begin
          c.alerts := 0;
          c.likes := 0;
          exit;
        end;
      end;
    end;
  end;
  </code></pre>
  
  <p><strong>MY PROBLEM</strong>: In the <code>process()</code> code, the first 2 <code>if</code> blocks (<code>email</code> and <code>timezone</code>) can read values into my record.  But when I add other <code>if</code> blocks (like <code>if jtr.Value.ToString = 'message_count' then</code>), I cannot see the values of my record anymore.</p>
  
  <p>Am I parsing the data properly?</p>
  
  <p>Basically, I need to grab the info from a JSON string and put the data inside a <code>TUserData</code> record.</p>
  
  <p>I have found the above pattern in a book titled "Expert Delphi", and I am pretty sure that the <code>parseData()</code> function is correct. Probably I am missing something in the process.</p>
  
  <p>The <code>TDMRrst</code> is a DataModule; I am giving the function a record, and I'd like the data to be properly parsed.</p>
  
  <p>What is wrong here?</p>