How to use getblocktemplate method with Bitcoinlib Library I am using
bitcoinlib to communicate with bitcoin-qt
This is the code i tried:
 Dim BitcoinService As Services.RpcServices.RpcService.IRpcService = New Services.Coins.Bitcoin.BitcoinService(&quot;http://localhost:8332&quot;, &quot;Username&quot;, &quot;Password&quot;, &quot;wallet password&quot;, 200)

for getblocktemplate this is the call
   Dim seg As JToken = &quot;{&quot;&quot;rules&quot;&quot;: [&quot;&quot;segwit&quot;&quot;]}&quot;

        RichTextBox5.Text = BitcoinService.GetBlockTemplate(seg).PreviousBlockHash

It gives me this error
BitcoinLib.ExceptionHandling.Rpc.RpcInternalServerErrorException
  HResult=0x80131500
  Message=JSON value is not an object as expected
  Source=BitcoinLib
  Arborescence des appels de procédure :
   à BitcoinLib.RPC.Connector.RpcConnector.MakeRequest[T](RpcMethods rpcMethod, Object[] parameters)
   à BitcoinLib.Services.CoinService.GetBlockTemplate(Object[] parameters)
   à WindowsApp3.Form1.Button2_Click(Object sender, EventArgs e) dans C:\Users\Hama\source\repos\WindowsApp3\WindowsApp3\Form1.vb :ligne 76
   à System.Windows.Forms.Control.OnClick(EventArgs e)
   à System.Windows.Forms.Button.OnClick(EventArgs e)
   à System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   à System.Windows.Forms.Control.WmMouseUp(Message&amp; m, MouseButtons button, Int32 clicks)
   à System.Windows.Forms.Control.WndProc(Message&amp; m)
   à System.Windows.Forms.ButtonBase.WndProc(Message&amp; m)
   à System.Windows.Forms.Button.WndProc(Message&amp; m)
   à System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp; m)
   à System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp; m)
   à System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   à System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&amp; msg)
   à System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   à System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   à System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   à Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
   à Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
   à Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
   à WindowsApp3.My.MyApplication.Main(String[] Args) dans  :ligne 81

  Cette exception a été levée à l'origine dans cette pile des appels :
    System.Net.HttpWebRequest.GetResponse()
    BitcoinLib.RPC.Connector.RpcConnector.MakeRequest&lt;T&gt;(BitcoinLib.RPC.Specifications.RpcMethods, object[])

Exception interne 1 :
WebException : Le serveur distant a retourné une erreur : (500) Erreur interne du serveur.



I dont understand what i am doing wrong, i think it's a json problem
Help is appreciated, thank you
If anyone else need it i post the solution here:
Dim seg As JToken = JToken.Parse(&quot;{&quot;&quot;rules&quot;&quot;: [&quot;&quot;segwit&quot;&quot;]}&quot;)