需要将json响应中的数据传递到后续请求的Post Body数据,但是它不起作用,出现了问题 [英] Need to pass a data from a json response to the subsequent request's Post Body data however it is not working, something is going wrong

查看:114
本文介绍了需要将json响应中的数据传递到后续请求的Post Body数据,但是它不起作用,出现了问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将json响应中的数据传递到后续请求的Post Body数据,但是它不起作用,出了点问题.

I need to pass a data from a json response to the subsequent request's Post Body data however it is not working, something is going wrong.

第一个请求在响应正文中返回JSON,如下所示:

First request returns the JSON in response body which looks like this:

"accessToken":[{"idToken":"eyJ05C3RU","token":"159c82d30ec3123e873ab989cc"}]
0000000

我必须提取"accessToken"值以将其传递到下一个请求的后正文数据(不在请求的参数选项卡下,它必须传递到下一个请求的BodyData选项卡)

I have to extract 'accessToken' value to pass it to the next request's post bodydata (not under parameter tab of the request, it has to pass to BodyData tab of the next request)

我已经为第一个请求创建了JSON路径提取器,以获取具有这些值的响应数据. 1JSON路径提取器:$..accessToken[0].idToken

I have created to JSON path extractors for the first request where getting response data with these values. 1JSON path extractor: $..accessToken[0].idToken

在json路径表达式中传递了此代码:$ .. accessToken [0] .idToken

passed this in json path expression:$..accessToken[0].idToken

在下一个请求的请求中:{ "idtoken": ${idToken}}

in the request of next request: { "idtoken": ${idToken}}

在树中查看结果: 根据请求显示帖子数据:

view results in tree: shows post data as request:

POST data:{  "idtoken": ${idToken}}

响应数据:

出问题了!SyntaxError:意外的令牌$

omething broke!SyntaxError: Unexpected token $

at `Object.parse (native)`

请帮助解决该问题.这真的很有帮助.

Please help to resolve the issue. it will be really helpful.

推荐答案

感谢所有帮助.通过在下一个请求正文中使用JSON路径表达式提取器作为"idtoken":"$ {idToken_1}",可以解决我的问题.

Thanks for all the help. I am able to overcome my issue by using JSON path expression extractor in the next request body as "idtoken": "${idToken_1}".

这篇关于需要将json响应中的数据传递到后续请求的Post Body数据,但是它不起作用,出现了问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆