我正在寻找一个允许我验证json的正则表达式.
我是Regex的新手,我知道用Regex解析很糟糕,但可以用来验证吗?
我有一个很大的文本文件。它混合了更多的行和各种信息
我的要求是从下面的混合字符串行检索 json
线 :
PID: [0] [STM] [2016-12-01 00:00:00,135] INFORMATION {com.priyan.JsonParser} - My Req Body: { "amountTxn": { "paymentAmt": { "amtReserved": null, "totalAmtCharged": null, "chargingData": { "taxAmt": 10, "categoryCode": "MyApp" }, "totalAmountRefunded": null, "chargingInformation": { "amount": 1.5, "description": ["Test 01 (demo)"] } }, "userId": "tel:+2313215", "txnStatus": "Charged", "origCode": null, "seq": null } } TOKEN ID: 351351 {com.priyan.JsonParser}
Run Code Online (Sandbox Code Playgroud)
我只需要提取这个json部分
{ "amountTxn": { "paymentAmt": { "amtReserved": null, "totalAmtCharged": null, "chargingData": { "taxAmt": 10, "categoryCode": "MyApp" }, "totalAmountRefunded": null, "chargingInformation": { "amount": …Run Code Online (Sandbox Code Playgroud)