Help parsing json

I’m wondering if it is possible for someone new to code to figure out how to parse the json below:

    "id": "recmREXIEy7NA1VK7",
    "fields": {
        "Name": "Welcoming Visitors",
        "Audio Link": "",
        "Chapter Section Number": 2,
        "Post Body": "<p>IT IS IMPORTANT TO REMEMBER that when visitors attend our Apostolic Faith services for the first time, their initial impression may determine their permanent attitude toward the Gospel of Jesus Christ. We only have one opportunity to make a positive first impression upon newcomers.<br></p><p>Visitors need to feel welcome, so it is important to put friendly, outgoing people in charge of greeting guests at church. It is a good practice to station greeters near the church entry to help people locate the nursery, Sunday school classrooms, elevator, or other facilities. Teach greeters and ushers to watch for people who might need additional help, such as those with strollers and small children, or people who need physical assistance.</p><p>In addition, we should encourage all of our congregation members to notice people who are attending for the first time, and to be welcoming. While we appreciate the fellowship we have with one another, we must take care that in enjoying each other’s company, the newcomers among us do not feel excluded.</p><p>During the service, the pastor or minister in charge should welcome from the pulpit visitors to the meeting; this is often done during the announcements after the initial period of congregational singing. While we want to make sure newcomers know that we are happy they have come, it generally is not advisable, at least in the United States, to make them conspicuous by asking them to stand when everyone else is seated or to raise their hand so others can identify them.</p><p>As pastors and ministers, we will want to be in the prayer room before services and at the altars after the services. This can make greeting visitors a challenge, but we can assign that to an associate minister, or as the occasion may demand, step away from the altar service for a few minutes ourselves.</p><p>During the singing of the closing hymn, it may be helpful to have a minister or designated workers go to the rear of the sanctuary to greet each departing visitor and extend a cordial invitation to return. The ministers should be alert to any indicators that the visiting individual would like to pray, and be ready to encourage them to do so as the Spirit leads.</p><p>Greeters or ushers should offer a recent edition of one of the Apostolic Faith publications to all first time visitors, and the visitor’s attention directed to the literature rack where samples of our other publications are available. In some of our churches, the greeters/ushers ask guests to fill out a visitor information card for follow-up or notification of upcoming special events.</p><p>‍</p>\n",
        "Slug": "welcoming-visitors",
        "Updated On": "2021-07-28T15:34:25.772Z",
        "Updated By": "Person_5d5365242c90f661591e1f60",
        "Created On": "2021-07-27T16:13:50.180Z",
        "Created By": "Person_5d5365242c90f661591e1f60",
        "Published On": "2021-08-12T20:00:26.726Z",
        "Published By": "Person_5d5365242c90f661591e1f60",
        "Collection ID": "61157b8004ea541c6ab21117",
        "Chapter": "61157b8004ea54f717b210f0",
        "Audio Preview": [
                "id": "atto2w2FYH6iYlFYP",
                "url": "",
                "filename": "Accountability to God.mp3",
                "size": 3848312,
                "type": "audio/mpeg"
    "createdTime": "2021-08-17T19:53:08.000Z"

@rmjjkj Welcome to the Community :partying_face:

Of course! you just need to use pm.response.json() method.


var resp = pm.response.json();

Now you need to use to get the id "recmREXIEy7NA1VK7"and so on…

This method will convert your entire response into JSON object and you can access them using dot/bracket notations.

Is this sufficient? Or you are looking here to reach any specific element in your response? Can you please elaborate your need?

Also if you are total beginner, please read this blog for better parsing of your JSON :blush:

1 Like

To expand on what @bpricilla said, if your field names contain spaces (which many of yours do, e.g. "Audio Link") then you have to use square brackets to help you to access the values. See illustration below:

var resp = pm.response.json();

console.log( // CORRECT - will print recmREXIEy7NA1VK7 in console window
console.log(resp.Audio Link) // INCORRECT - Javascript won't understand how to handle the space in the name
console.log(resp["Audio Link"]) // CORRECT - will print your mp3 filename in console

If you want to access the "Audio Preview" section, there is small one extra challenge. The { } symbols within the Audio Preview section indicate that this is the first item in a list - in other words, the json could potentially contain multiple previews in this section. Even if you only ever have one item in this section, you still have to be explicit in stating that you want item #0 (i.e. the first item) from that section.

So you could chain together this advice, and if you wanted to access the size of the Audio Preview, you can do so as follows:

var resp = pm.response.json();
console.log(resp.fields["Audio Preview"][0].size) // will print 3848312

If any of this is confusing then please feel free to ask further :slight_smile:


Spot on!! Thanks :smiley:

I was searching for a similar solution, this will save some of my extra efforts :stuck_out_tongue:


@neilstudd @bpricilla Thank you so much for your replies. I should have said that I am a no-coder trying to find my way through code to get a task accomplished.

The task I am trying to accomplish is getting the json response into an xml file. Is this possible?

I came across this post, Postman, and foked it into my workspace but was unable to follow it all the way through due to my lack of knowledge of code.

Is this the only process to get to an xml file from json response?

I pasted the code you shared under tests and resent the request. Is this what I was supposed to do?

I got this error message.

Thanks you!