JSON代码的正则表达式

时间:2018-08-08 11:37:39

标签: regex jmeter

我正在尝试提取access_token值。 任何人都知道如何提取它。

{"access_token":"c170f85d-9371-31c3-a4fa-1f0865ef28da","refresh_token":"6312ab1a-e257-38e9-aab1-8f8071dfd643","scope":"openid","id_token":"eyJ4NXQiOiJOVEF4Wm1NeE5ETXlaRGczTVRVMVpHTTBNekV6T0RKaFpXSTRORE5sWkRVMU9HRmtOakZpTVEiLCJraWQiOiJOVEF4Wm1NeE5ETXlaRGczTVRVMVpHTTBNekV6T0RKaFpXSTRORE5sWkRVMU9HRmtOakZpTVEiLCJhbGciOiJSUzI1NiJ9.eyJhdF9oYXNoIjoibTFGZUk4ZFJFbDV6azZoTFd2VUxBUSIsImNfaGFzaCI6IkRGbVY3RUt4dzlhck4xNFhDOUxQT1EiLCJzdWIiOiJzb2wxdXNlcjYwIiwiYXVkIjpbInRlc3RtYW5lZXNoYWNvZGUwMDAwMDAxMjMwMDAwIl0sImF6cCI6InRlc3RtYW5lZXNoYWNvZGUwMDAwMDAxMjMwMDAwIiwiYW1yIjpbIkJhc2ljQXV0aGVudGljYXRvciJdLCJpc3MiOiJodHRwczpcL1wvbG9jYWxob3N0Ojk0NDNcL29hdXRoMlwvdG9rZW4iLCJleHAiOjE1MzM3Mjk4MjYsImlhdCI6MTUzMzcyNjIyNiwic2lkIjoiZmE0NDNjZTMtNTI0MS00N2ZkLWIxYzYtMDkxNTU1ODNmZDcwIn0.J6ymae3s4UOvNRiJIL_kdni4HRgUoIHf4speGduQjGd_ny_3ow0MjxHW51wxJfAWpSw9a8cMfc5DkI0lgQmPoWUeNlQ1-loNOGPCMREE4PfJPG312psjxecIjU0j7fr8ma-wAkPKMicSK1VrrbURgU9XdVjve3iVOyAW7ypuGuIgOqwulQdYMldTVBrixWjQvjmygezV30V48OAY8oNIrp6nLWzBUV9w9Zb7_ASblLSezMceIecHMl-0EBAnMYvqgxtbk8aB* Connection #0 to host localhost left intact tLOsz3bqAonEMk3EvnWrQ7GsL2Mrtc_Wo2n7bfv3fkdjkeeb8fuVqUuC4nG-u2In9hdck8HOXoojZQ","token_type":"Bearer","expires_in":2881}

我只需要从上述回复中获得c170f85d-9371-31c3-a4fa-1f0865ef28da

如何使用正则表达式获取它?

1 个答案:

答案 0 :(得分:0)

JSON extractor作为子级添加到超出响应范围的请求中

使用$..access_token作为JSON路径表达式。  不匹配1 给变量起名字

要访问变量,可以使用${variablename}

有关正则表达式提取follow this link

的更多信息