Json response in get_account()

I’m relatively new to python, so forgive the basic question. I’m trying to get my account information, which I have done, but I can’t seem to dump it to raw json. Here is what I’ve done:

api = tradeapi.REST(key_id=config.paperAPIKey,secret_key=config.paperSecret,base_url=config.paperAccountURL)
account = api.get_account()
print (account)

it prints this (i’ve changed values for the forum)

Account({   'account_blocked': False,
    'account_number': 'PA555C2E18OC',
    'accrued_fees': '0',
    'buying_power': '417099.44',
    'cash': '104274.86',
    'created_at': '2022-05-06T20:07:01.223703Z',
    'crypto_status': 'ACTIVE',
    'currency': 'USD',
    'daytrade_count': 0,
    'daytrading_buying_power': '417099.44',
    'equity': '104274.86',
    'id': 'dcf55550-783b-4b57-99f5-554bad3ad360',
    'initial_margin': '0',
    'last_equity': '104274.86',
    'last_maintenance_margin': '0',
    'long_market_value': '0',
    'maintenance_margin': '0',
    'multiplier': '4',
    'non_marginable_buying_power': '104274.86',
    'pattern_day_trader': True,
    'pending_transfer_in': '0',
    'portfolio_value': '104274.86',
    'regt_buying_power': '208549.72',
    'short_market_value': '0',
    'shorting_enabled': False,
    'sma': '104274.86',
    'status': 'ACTIVE',
    'trade_suspended_by_user': False,
    'trading_blocked': False,
    'transfers_blocked': False})

So far so good, but I just want the raw json data. It is a type:
<class ‘alpaca_trade_api.entity.Account’>

This throws an error:

account = api.get_account()
print (json.dump(account))

How do I dump the data in the object?

I found the answer to my own question. Use the _raw property. like this:

api = tradeapi.REST(key_id=config.paperAPIKey,secret_key=config.paperSecret,base_url=config.paperAccountURL)
account = api.get_account()
print (json.dumps(account._raw))

I was struggling with the list_positions() method. The ._raw property threw an error.

For anyone else following along I just discovered adding raw_data=True to the REST() method resolves this. like this:

api = tradeapi.REST(raw_data=True,key_id=config.paperAPIKey,secret_key=config.paperSecret,base_url=config.paperAccountURL)