user3834163
user3834163

Reputation: 137

JMeter JSON Path Extractor - need select only certain Id

I am getting JSON with several Id records. I need only the parent level Id what is highlighted at the picture below. JSON Path is: .Id, see belowenter image description here: enter image description here

Currently I am getting back all Id:

LoanHistoryIDs_1=54bb6a6ecbda714f6c1c4348
LoanHistoryIDs_2=5570675ecbda712418a92f4c
LoanHistoryIDs_3=53fed26acbda7151983a9d18
LoanHistoryIDs_4=54bb6a6ccbda714f6c1c4344
LoanHistoryIDs_5=54bb6a6ecbda714f6c1c4349
LoanHistoryIDs_6=54bb6a6dcbda714f6cffd23f
LoanHistoryIDs_7=53fed26acbda7151983a9d18
LoanHistoryIDs_8=54bb6a6ccbda714f6c1c4344

How can I filter only what I need?

part of JSON from comment:

[{ "Id": "54bb6a6ecbda714f6c1c4348", "Lenders": [{ "Id": "5570675ecbda712418a92f4c", "Name": "MORGAN STANLEY MORTGAGE CAPITAL HOLDINGS LLC" }], "Borrowers": [{ "Id": "53fed26acbda7151983a9d18", "Name": "120" }], "TransactionDate": null, "Type": "Original Loan", "Date": "2013-12-16T00:00:00Z", "Amount": 135, "MaturityDate": "2020-01-01T00:00:00Z", "Structure": "CMBS", "CMBSList": [{ "Id": "54bb6a6ccbda714f6c1c4344", "Name": "Morgan Stanley Bank of America Merrill Lynch Trust 2014-C14" }] }, { "Id": "54bb6a6ecbda714f6c1c4349",

Upvotes: 2

Views: 474

Answers (1)

Ori Marko
Ori Marko

Reputation: 58872

You don't need plugin, use JSON Extractor with $.Id as JSON Path Expressions value to get the id value under root, not including other id in hierarchy

EDIT

In case of JSON array use or [0].Id for first Id or [*].Id for all Ids.

Upvotes: 2

Related Questions