0

Need to extract entire database_schema_detail object from the below json body for postman.Any suggestion?

Json Body

    "created_operator": "0",
    "database": "postgres",
    "database_schema_detail": {
      "accounts": [
        "employer_id",
        "id",
        "role_id"
      ],
      "awsdms_ddl_audit": [
        "c_ddlqry",
        "c_key",
        "c_name",
        "c_oid",
        "c_schema",
        "c_tag",
        "c_time",
        "c_txn",
        "c_user"
      ],
      "new_accounts": [
        "employer_id",
        "id",
        "role_id"
      ]
    },
    "dms_endpoint_id": "test0700362021-10-07t13-19-36-331734",
    "engine": "postgresql",
    "engine_display_name": "PostgreSQL",

1 Answer 1

1

Parse the JSON and access the property:

let responseBody = JSON.parse(body);
console.log(responseBody.database_schema_detail);
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks Tushar Shahi for your response..could you help to extract the entire elements of database_schema_detail , my objective is to store the entire o/p for database_schema_detail in a variable so that i can pass it as a parameter to the request body. My Code: pm.test('Validate Schema',function(){ var jsonData=pm.response.json(); pm.environment.set('dbSchemaDetails',jsonData.data.database_schema_detail); console.log(jsonData.data.database_schema_detail); }) Here i am able to log the output ,but unable to store it into "dbSchemaDetails" Appreciate your help..
Hi Tushar, Was able to solve the issue using JSON.stringify...Thanks for the assist

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.