Thanks Steeve!!
I have tried as below:
in Mongo DB i have below pipeline:
"_id" : %s,
"my_dt" : ISODate(%s)
in Python i have as below:
_id and my_dt from mongo db substituted with id and myDate variables in python. srcQuery has pipeline fetched from Mongodb.
srcQueryToAggregate = srcQuery % ('"'+id+'"','"'+myDate+'"')
print(srcQueryToAggregate)
pipeline = json.loads(srcQueryToAggregate)
It prints as below:
```
"_id" : "XYZ-1"
"my_dt" : ISODate("2022-10-31T04:00:00Z")
```
Although printing is good, i m getting below error for date at json.loads … ("_id" working fine.)
file “C:\Program Files\Python38\lib\json\decoder.py” line 2, in raw_decode
raise JSONDecodeError(“Expecting Value”, s, err.value) from None
json.decoder.JSONDecodeError: Expecting value : line 2 column 24(char)
i have date value… but still it throws error as Expecting value for my_dt. … Please advise