Oct-08-2022, 11:00 AM
The data is probably coming from a Json and has been now encoded to a Python dictionary.
Then work with dictionary no regex need.
Then work with dictionary no regex need.
data = { "_index": "testdataset", "_type": "_doc", "_id": "11234567891098646", "_score": 1, "_source": { "_class": "net.local.host.ca", "orderNo": "16536668566434698646", "orderDt": "20220527", "source": 0, "mchntId": "0000000002", "mchntOrderNo": "01a3f2b53d16290f41f", "appid": "0000000003", "payChannelId": "payid", "amount": 300, "clientIp": "192.168.0.1", "currency": "0", "subject": "", "body": "", "cpChannel": "google_upi", "timeExpire": 1653678578000, "description": "", "created": 1653657857000, "timePaid": 1653657876000, "bankType": "", "paySt": 2, "refundSt": 0, "refundedAmt": 0, "checkSt": 0, "fee": 21, "chnlFee": 9, "settleSt": 1, "rutId": "0000000098", "bankRspDesc": "", "bankTransactionId": "20220527212419602959728091384475", "credential": "214721678116", "notifyUrl": "https://localhost/test/site", "pageNotifyUrl": "https://localhost/test/site", "notifyCnt": 0, "notifySt": 0, "openId": "", "extra": "", "countryId": "Brazil", "areaId": "", "regionId": "brazil", "cityId": "toto", "countyId": "", "modified": 1124657876000, "channlInfoId": "b0768be2248a4aee94ac747c2ab0000", "email": "[email protected]", "mobile": "100000012457", "accountOwner": "Tom Hank", "merchantParam": "game", "transTp": 0, "payAccount": "", "payType": "", "bankCode": "", "settleBatchNo": "2022124578950", "startRow": 0, "pageSize": 0 } }Use.
>>> data['_id'] 11234567891098646 >>> data["_source"]["amount"] 300 >>> data["_source"]["countryId"] Brazil