title: Delphi Rest.JSON JsonToObject only works with f variables
body: <p>I'm using Delphi XE8.</p>
  <p>I was just looking at the <code>REST.Json ObjectToJsonString()</code> and <code>JsonToObject()</code> calls.</p>
  <p>Mainly attempting to do something like this:</p>
  <p><a href="https://community.idera.com/developer-tools/b/blog/posts/how-to-convert-an-object-to-json-and-back-with-a-single-line-of-code" rel="nofollow noreferrer">How to convert an object to JSON and back with a single line of code</a></p>
  <p>I noticed that I could only get variables to work when they started with an <code>F</code> character. I couldn't find any documentation on this. Is this expected behavior? Should I be naming all variables inside of my classes with an <code>F</code> at the start? If Yes, can someone explain why?</p>
  <p>I created a class <code>TTestJSON</code> and defined two member variables and set them to 'WORKS' and 'FAILS'.</p>
  <p>Then I created a JSON string value from the object:</p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;varThatWorksBeacuseItStartsWithF&quot;:&quot;WORKS&quot;,
    &quot;sVarThatFailsBecauseItStartsWithS&quot;:&quot;FAILS&quot;
  } 
  </code></pre>
  <p>When going back from a JSON string to object, only the <code>fVarThatWorksBeacuseItStartsWithF</code> variable is being reset correctly.  In the code below, <code>test := TJson.JsonToObject&lt;TTestJSON&gt;(JsonStr);</code> using the above JSON, notice that the <code>sVarThatFailsBecauseItStartsWithS</code> is <code>&quot;&quot;</code> and not <code>&quot;FAILS&quot;</code>.</p>
  <pre class="lang-pascal prettyprint-override"><code>procedure TForm3.btn1Click(Sender: TObject);
  var
    test : TTestJSON;
    JsonStr : String;
  begin
    m1.Clear;
    test := TTestJSON.Create;
    try
      test.fVarThatWorksBeacuseItStartsWithF := 'WORKS';
      test.sVarThatFailsBecauseItStartsWithS := 'FAILS';
      JsonStr := TJson.ObjectToJsonString( test );
    finally
      test.Free;
    end;
    m1.Lines.Add(  '** JSONStr Value START **' + #13#10 + JsonStr + '** JSONStr Value END **' + #13#10 );
  
    test := TJson.JsonToObject&lt;TTestJSON&gt;(JsonStr);
    try
      m1.Lines.Add('** Obj loaded from JSON String Start **' + #13#10 + TJson.ObjectToJsonString( test ) + #13#10 + '** Obj loaded from JSON String End **');
    finally
      test.Free;
    end;
  end;
  </code></pre>
  <p>From the results, the var that starts with <code>f</code> has the <code>f</code> stripped out of the JSON string, and the one that starts with <code>s</code> still has it in there. I would have expected that the second result would have looked like this:</p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;varThatWorksBeacuseItStartsWithF&quot;:&quot;WORKS&quot;,
    &quot;sVarThatFailsBecauseItStartsWithS&quot;:&quot;FAILS&quot;
  }
  </code></pre>
  <p>Here is the full code to reproduce - just has a button and a memo on a vcl form - also uses REST.Json:</p>
  <pre class="lang-pascal prettyprint-override"><code>unit Main;
  
  interface
  
  uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, rest.Json;
  
  type
    TTestJSON = class
      fVarThatWorksBeacuseItStartsWithF : String;
      sVarThatFailsBecauseItStartsWithS : String;
    end;
  
    TForm3 = class(TForm)
      btn1: TButton;
      m1: TMemo;
      procedure btn1Click(Sender: TObject);
    private
      { Private declarations }
    public
      { Public declarations }
    end;
  
  var
    Form3: TForm3;
  
  implementation
  
  {$R *.dfm}
  
  procedure TForm3.btn1Click(Sender: TObject);
  var
    test : TTestJSON;
    JsonStr : String;
  begin
    m1.Clear;
    test := TTestJSON.Create;
    try
      test.fVarThatWorksBeacuseItStartsWithF := 'WORKS';
      test.sVarThatFailsBecauseItStartsWithS := 'FAILS';
      JsonStr := TJson.ObjectToJsonString( test );
    finally
      test.Free;
    end;
    m1.Lines.Add(  '** JSONStr Value START **' + #13#10 + JsonStr + '** JSONStr Value END **' + #13#10 );
  
    test := TJson.JsonToObject&lt;TTestJSON&gt;(JsonStr);
    try
      m1.Lines.Add('** Obj loaded from JSON String Start **' + #13#10 + TJson.ObjectToJsonString( test ) + #13#10 + '** Obj loaded from JSON String End **');
    finally
      test.Free;
    end;
  end;
  
  end.
  </code></pre>