Object of type int64 is not JSON serializable

Hi, I am getting following error:

NIFTY23SEP19750PE {‘code’: ‘500’, ‘data’: TypeError(‘Object of type int64 is not JSON serializable’)}

I am getting above error randomly sometimes. Please help me.

Here’s my order placement code:

def placeOrderFyers(inst ,t_type,qty,order_type,price,variety):
    exch = inst[:3]
    symb = inst[4:]
    papertrading = 1 
    print(" => ",t_type," ",symb," ",qty," ",order_type," @ price =  ",price)
    if(order_type=="MARKET"):
        type1 = 2
    elif(order_type=="LIMIT"):
        type1 = 1
    if(t_type=="BUY"):
        side1=1
    elif(t_type=="SELL"):
        side1=-1
    data =  {
        "symbol":inst,
        "qty":qty,
        "type":type1,
        "side":side1,
        "productType":"INTRADAY",
        "limitPrice":0,
        "stopPrice":0,
        "validity":"DAY",
        "disclosedQty":0,
        "offlineOrder":"False",
        "stopLoss":0,
        "takeProfit":0
    }
    try:
        if (papertrading == 1):
            orderid = fyers.place_order(data)
            print(" => ", symb , orderid)
            return orderid
        else:
            return 0
    except Exception as e:
        print(" => ", symb , "Failed : {} ".format(e))

Hi @mrinal.u5lkbay0

We already replied for same.
Please find answer on your previous post.

@Z4PBvkQGyF I am getting similar issue, Can you please help me

Can you please let me know, what is the problem in my payload ? I am placing limit order

Copy

{'symbol': 'MCX:SILVERMIC24NOVFUT', 'qty': 1, 'type': 1, 'side': 1, 'productType': 'MARGIN', 'limitPrice': 91496, 'stopPrice': 0, 'validity': 'DAY', 'stopLoss': 0, 'takeProfit': 0, 'offlineOrder': False, 'disclosedQty': 0} 

{'Error': 'Object of type int64 is not JSON serializable'}