title: Convert AnsiString to UnicodeString in Lazarus with FreePascal
body: <p>I found similar topics here but none of them had the solution to my question, so I am asking it in a new thread. </p>
  
  <p>Couple of days ago, I changed the format the preferences of an application I am developing is saved, from INI to JSON.</p>
  
  <p>I use the jsonConf unit for this.  </p>
  
  <p>A sample of the code I use to save a key-value pair in the file would be like below.</p>
  
  <pre><code>Procedure TMyClass.SaveSettings();
  var
    c: TJSONConfig;
  begin
    c:= TJSONConfig.Create(nil);
    try
      c.Filename:= m_settingsFilePath; 
      c.SetValue('/Systems/CustomName', m_customName);
    finally
      c.Free;
    end;
  end;
  </code></pre>
  
  <p>In my code, m_customName is an AnsiString type variable. TJSONConfig.SetValue procedure requires the key and value both to be of UnicodeString type. The application compiles fine, but I get warnings such </p>
  
  <pre><code>Warning: Implicit strung type conversion from "AnsiString" to "UnicodeString". 
  </code></pre>
  
  <p>Some messages warn saying there is a potential data loss. </p>
  
  <p>Of course I can go and change everything to UnicodeString type but this is too risky. I have't seen any issues so far by ignoring these warnings, but they show up all the time and it might cause issues on a different PC. </p>
  
  <p>How do I fix this?</p>