Jump to content
WAPT Forum
Sign in to follow this  
Guest KirkL

Parsing JSON from response body and putting it into a variable

Recommended Posts

Guest KirkL

I am new to WAPT and having trouble taking JSON from the response body, putting it into a variable, then using it on a subsequent request body.

 

I have the JSON module installed and am using WAPT 7.5.

 

My response body on one request is JSON that looks like the following:

 

[

{ "name":"john" },

{ "Id":10 }

]

 

I simplified it considerably, but debugged into a Javascript file where I copied the output to make sure I know the syntax.

 

In the end I need <object>[1].Id. So I created a "Response processing" variable named "userId" and added a "JSON Text" function for it to get "[1].Id", but I know I am missing something. It's like I need "$Var(Respose_Body)[1].Id" or something.

 

Any ideas?

 

In the next request I used $Var(userId) in the request body, but it just shows up as hard-coded "[1].Id" instead of my value.

Share this post


Link to post
Share on other sites
Guest KirkL

Could you give me your profile or send it to support?

 

I figured it out and was unable to delete my thread yesterday since it hadn't gone through the moderator yet. I was looking through the help docs and didn't notice that there was a separate help doc for the JSON module. Once I found that I realized that $JPath was what I needed.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...