How do I use the getblocktemplate RPC command of Bitcoin Core GUI? I tried the following usages but none of them worked I tried the following commands, but none of them worked.
-getblocktemplate &quot;segwit&quot;
-Error: Error parsing JSON: segwit

-getblocktemplate (&quot;segwit&quot;)
-Error: Error parsing JSON: segwit

-getblocktemplate &quot;rules&quot;: [&quot;segwit&quot;]
-Error: Error parsing JSON: rules:

-getblocktemplate {&quot;rules&quot;: [&quot;segwit&quot;]}
-Error: Error parsing JSON: {rules:

-getblocktemplate
-getblocktemplate must be called with the segwit rule set (call with {&quot;rules&quot;: [&quot;segwit&quot;]}) (code -8)

-getblocktemplate {&quot;rules&quot;: [&quot;segwit&quot;]}
-Error: Error parsing JSON: {rules:

How can I use this command correctly?
The GUI's debug console operates similarly to a shell. It needs quotes around the entire JSON string so that it is first interpreted as a string before the JSON is parsed. Then, if you used double quotes, you need to escape the quotes that are part of the JSON so that they aren't misinterpreted.
A valid way of writing this command is
getblocktemplate &quot;{\&quot;rules\&quot;:[\&quot;segwit\&quot;]}&quot;

Alternatively, to avoid additional escaping, you can use single quotes on the outside:
getblocktemplate '{&quot;rules&quot;:[&quot;segwit&quot;]}'