toJson method

  1. @override
Map<String, dynamic> toJson()
override

Serialises this class into a JSON object.

class Item extends Serializable {
  const(this.name, this.count);
  final String name;
  final int? count;
}

final Item x = Item('apple', 10);
print(x.toJson()); // { 'name': 'apple', 'count': 10 }

Implementation

@override
Map<String, dynamic> toJson() => {
  'accountType': accountType,
  'manager': manager,
  'staker': staker,
  'stakeDepositAuthority': stakeDepositAuthority,
  'stakeWithdrawBumpSeed': stakeWithdrawBumpSeed,
  'validatorList': validatorList,
  'reserveStake': reserveStake,
  'poolMint': poolMint,
  'managerFeeAccount': managerFeeAccount,
  'tokenProgramId': tokenProgramId,
  'totalLamports': totalLamports,
  'poolTokenSupply': poolTokenSupply,
  'lastUpdateEpoch': lastUpdateEpoch,
  'lockup': lockup.toJson(),
  'epochFee': epochFee.toJson(),
  'nextEpochFee': nextEpochFee?.toJson(),
  'preferredDepositValidatorVoteAddress': preferredDepositValidatorVoteAddress,
  'preferredWithdrawValidatorVoteAddress': preferredWithdrawValidatorVoteAddress,
  'stakeDepositFee': stakeDepositFee.toJson(),
  'stakeWithdrawalFee': stakeWithdrawalFee.toJson(),
  'nextStakeWithdrawalFee': nextStakeWithdrawalFee?.toJson(),
  'stakeReferralFee': stakeReferralFee,
  'solDepositAuthority': solDepositAuthority,
  'solDepositFee': solDepositFee.toJson(),
  'solReferralFee': solReferralFee,
  'solWithdrawAuthority': solWithdrawAuthority,
  'solWithdrawalFee': solWithdrawalFee.toJson(),
  'nextSolWithdrawalFee': nextSolWithdrawalFee?.toJson(),
  'lastEpochPoolTokenSupply': lastEpochPoolTokenSupply,
  'lastEpochTotalLamports': lastEpochTotalLamports,
};