-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
Dear BTCPay team,
I am using NBitpayClient 1.0.0.39:
<PackageReference Include="NBitpayClient" Version="1.0.0.39" />
I am trying to serialize and deserialize in JSON the invoice structure using System.Text.Json, where MyBTCPay is an instance of NBitpayClient.Bitpay:
using System.Text.Json;
var satsAmount = 100000;
var invoice = await MyBTCPay.CreateInvoiceAsync(new NBitpayClient.Invoice(satsAmount, "SATS"));
var jsonString = JsonSerializer.Serialize(invoice);
var invoice2 = JsonSerializer.Deserialize<NBitpayClient.Invoice>(jsonString);
But when I try to deserialize the jsonString into invoice2, I get the following error:
---> System.NotSupportedException: Deserialization of reference types without parameterless constructor is not supported. Type 'NBitcoin.Money'
Do you have any suggestion about how I can properly serialize/deserialize a NBitpayClinet Invoice in JSON?
Many thanks in advance!
Metadata
Metadata
Assignees
Labels
No labels