Google Drive API v3 use JSON instead of P12 (Service Account) - Unexpected character
<blockquote>
  <p>Error: Unexpected character encountered while parsing value: e. Path
  '', line 0, position 0.</p>
</blockquote>

<p>I am using the Google .Net Client library to access the Google drive API v3 specifically the <a href="https://www.nuget.org/packages/Google.Apis.Drive.v3/" rel="noreferrer">Google.Apis.Drive.v3</a> package.  I am authorizing using "Service Account" with C#.</p>

<p>Authorization with the p12 key is no problem. However, JSON is recommended and p12 format is maintained for backward compatibility.</p>

<p>I downloaded the JSON file from the Google Developers Console and tried to make the authorization with the following code:</p>

<pre><code>    public static Google.Apis.Drive.v3.DriveService AuthenticateServiceAccountJSON(string keyFilePath) {

        // check the file exists
        if (!File.Exists(keyFilePath)) {
            Console.WriteLine("An Error occurred - Key file does not exist");
            return null;
        }

        string[] scopes = new string[] { DriveService.Scope.Drive,                  // view and manage your files and documents
                                         DriveService.Scope.DriveAppdata,           // view and manage its own configuration data
                                         DriveService.Scope.DriveFile,              // view and manage files created by this app
                                         DriveService.Scope.DriveMetadataReadonly,  // view metadata for files
                                         DriveService.Scope.DriveReadonly,          // view files and documents on your drive
                                         DriveService.Scope.DriveScripts };         // modify your app scripts     

        try {
            using (var stream = new FileStream(keyFilePath, FileMode.Open, FileAccess.Read)) {
                var credential = GoogleCredential.FromStream(stream);
                if (credential.IsCreateScopedRequired) {
                    credential.CreateScoped(scopes);
                }
                // Create the service.
                Google.Apis.Drive.v3.DriveService service = new Google.Apis.Drive.v3.DriveService(new BaseClientService.Initializer() {
                    HttpClientInitializer = credential,
                    ApplicationName = "MyDrive",
                });
                return service;
            }
        } catch (Exception ex) {
            Console.WriteLine(ex.InnerException);
            return null;

        }
    }
</code></pre>

<p>I have looked at the JSON file in notepad and it seems encrypted.</p>

<blockquote>
  <p>"ewogICJ0eXBlIjogInNlcnZpY2VfYWNjb3VudCIsCiAgInByb2plY3RfaWQiOiAicmFkaWFudC1tZXJjdXJ5LTEyMjkwNyIsCiAgIn.........."</p>
</blockquote>

<p>Is it ok to continue using the P12 ?</p>