I’m having trouble using the selector of the response. I want to extract the id of items that have “Open” as its status. Here is my gjson path
res.json(‘data.#(status==“Open”)#.id’) → keep showing ‘undefined’, what am I missing here?
{"data": [
{
"completedAt": null,
"createdAt": "2020-12-10T10:53:26.945Z",
"createdBy": "13814035-1dd2-11b2-82c4-35be246034a1",
"details": [
{
"content": "always",
"createdAt": "2020-12-10T10:53:47.360Z",
"createdBy": "bc56d608-fff6-45d0-b093-785ff060f617",
"id": "ba5a0403-64b6-4b2a-ad4f-083306df48dd",
"modifiedAt": "2020-12-10T10:53:47.360Z",
"modifiedBy": "",
"questionId": "bd40afb7-a279-4226-b524-1f6fbf8a7640",
"responseId": "2c592e1b-e2d6-4e17-97f0-f23efd5082de",
"score": 5
},
{
"content": "always",
"createdAt": "2020-12-10T10:53:49.240Z",
"createdBy": "bc56d608-fff6-45d0-b093-785ff060f617",
"id": "19db53ae-3288-4222-bdd2-65af5b9d2f47",
"modifiedAt": "2020-12-10T10:53:49.240Z",
"modifiedBy": "",
"questionId": "7e9c7672-6804-49e1-bbe9-c8aa72c9f7fd",
"responseId": "2c592e1b-e2d6-4e17-97f0-f23efd5082de",
"score": 5
},
{
"content": "always",
"createdAt": "2020-12-10T10:53:50.666Z",
"createdBy": "bc56d608-fff6-45d0-b093-785ff060f617",
"id": "0f0c59e7-b10f-4f2d-b3d4-779056dc241e",
"modifiedAt": "2020-12-10T10:53:50.666Z",
"modifiedBy": "",
"questionId": "345ecd25-8757-43f2-acbd-608de5612f55",
"responseId": "2c592e1b-e2d6-4e17-97f0-f23efd5082de",
"score": 5
},
{
"content": "always",
"createdAt": "2020-12-10T10:53:52.559Z",
"createdBy": "bc56d608-fff6-45d0-b093-785ff060f617",
"id": "d3e04358-c014-48b9-9763-9856e4805aa2",
"modifiedAt": "2020-12-10T10:53:52.559Z",
"modifiedBy": "",
"questionId": "b37ae883-ee3f-4470-b7e4-25b1d3ac874a",
"responseId": "2c592e1b-e2d6-4e17-97f0-f23efd5082de",
"score": 5
}
],
"from": "2020-08-14",
"id": "2c592e1b-e2d6-4e17-97f0-f23efd5082de",
"latestQuestionId": "b37ae883-ee3f-4470-b7e4-25b1d3ac874a",
"maxScore": "79.4",
"mode": "touch",
"modifiedAt": "2020-12-10T10:53:56.862Z",
"modifiedBy": "",
"no": "2940",
"outcomeStatus": "Mild",
"patientId": "bc56d608-fff6-45d0-b093-785ff060f617",
"questionTime": [
"10:00",
"22:00"
],
"score": 20,
"status": "Submitted",
"survey": {
"createdAt": "2020-10-21T07:47:03.542Z",
"createdBy": null,
"description": null,
"domainVersionId": "72de0eb0-db37-4e12-bd6a-73e563e02600",
"id": "dc146f39-5203-4369-ba5f-e92c8b041ad1",
"introduction": "The DEMO Depression item banks assess self-reported negative mood (sadness, guilt), views of self (selfcriticism, worthlessness), and social cognition (loneliness, interpersonal alienation), as well as decreased positive affect and engagement (loss of interest, meaning, and purpose)",
"modifiedAt": "2020-10-21T07:47:03.542Z",
"modifiedBy": null,
"name": "DEMO - 29 Depression (v2.1)",
"publishedAt": null,
"publishedBy": null,
"status": "Active",
"surveySchedule": {
"createdAt": "2020-10-21T07:47:04.074Z",
"createdBy": null,
"from": "2020-08-14",
"id": "dc146f39-5203-4369-ba5f-e92c8b041ad1",
"modifiedAt": "2020-12-09T10:00:02.175Z",
"modifiedBy": null,
"questionPerSession": 4,
"questionTime": [
"10:00",
"22:00"
],
"to": "2020-12-30"
},
"surveyTypeId": "8f5dbfd9-c138-4dee-b65d-98c102d47efe",
"userId": null
},
"surveyId": "dc146f39-5203-4369-ba5f-e92c8b041ad1",
"tScore": "58.5",
"to": "2020-12-30"
},
{
"completedAt": null,
"createdAt": "2020-12-10T10:51:57.458Z",
"createdBy": "13814035-1dd2-11b2-82c4-35be246034a1",
"details": [
{
"content": "always",
"createdAt": "2020-12-10T10:52:10.648Z",
"createdBy": "bc56d608-fff6-45d0-b093-785ff060f617",
"id": "d6d65183-ed9a-4c0c-b2d5-129fa9aa9828",
"modifiedAt": "2020-12-10T10:52:10.648Z",
"modifiedBy": "",
"questionId": "bd40afb7-a279-4226-b524-1f6fbf8a7640",
"responseId": "885c9e53-4b0b-468b-b6a0-504dc0737c82",
"score": 5
},
{
"content": "always",
"createdAt": "2020-12-10T10:52:12.112Z",
"createdBy": "bc56d608-fff6-45d0-b093-785ff060f617",
"id": "db7d89dd-05d5-4e1f-8bc6-43d5533455f3",
"modifiedAt": "2020-12-10T10:52:12.112Z",
"modifiedBy": "",
"questionId": "7e9c7672-6804-49e1-bbe9-c8aa72c9f7fd",
"responseId": "885c9e53-4b0b-468b-b6a0-504dc0737c82",
"score": 5
},
{
"content": "always",
"createdAt": "2020-12-10T10:52:15.324Z",
"createdBy": "bc56d608-fff6-45d0-b093-785ff060f617",
"id": "ed02bb73-593e-4884-891e-388617bb3741",
"modifiedAt": "2020-12-10T10:52:15.324Z",
"modifiedBy": "",
"questionId": "345ecd25-8757-43f2-acbd-608de5612f55",
"responseId": "885c9e53-4b0b-468b-b6a0-504dc0737c82",
"score": 5
},
{
"content": "always",
"createdAt": "2020-12-10T10:52:17.485Z",
"createdBy": "bc56d608-fff6-45d0-b093-785ff060f617",
"id": "bb350dbb-e2fc-4773-a8af-e6ee4722bcfd",
"modifiedAt": "2020-12-10T10:52:17.485Z",
"modifiedBy": "",
"questionId": "b37ae883-ee3f-4470-b7e4-25b1d3ac874a",
"responseId": "885c9e53-4b0b-468b-b6a0-504dc0737c82",
"score": 5
}
],
"from": "2020-08-14",
"id": "885c9e53-4b0b-468b-b6a0-504dc0737c82",
"latestQuestionId": "b37ae883-ee3f-4470-b7e4-25b1d3ac874a",
"maxScore": "79.4",
"mode": "touch",
"modifiedAt": "2020-12-10T10:52:21.155Z",
"modifiedBy": "",
"no": "4604",
"outcomeStatus": "Mild",
"patientId": "bc56d608-fff6-45d0-b093-785ff060f617",
"questionTime": [
"10:00",
"22:00"
],
"score": 20,
"status": "Submitted",
"survey": {
"createdAt": "2020-10-21T07:47:03.542Z",
"createdBy": null,
"description": null,
"domainVersionId": "72de0eb0-db37-4e12-bd6a-73e563e02600",
"id": "dc146f39-5203-4369-ba5f-e92c8b041ad1",
"introduction": "The DEMO Depression item banks assess self-reported negative mood (sadness, guilt), views of self (selfcriticism, worthlessness), and social cognition (loneliness, interpersonal alienation), as well as decreased positive affect and engagement (loss of interest, meaning, and purpose)",
"modifiedAt": "2020-10-21T07:47:03.542Z",
"modifiedBy": null,
"name": "DEMO - 29 Depression (v2.1)",
"publishedAt": null,
"publishedBy": null,
"status": "Active",
"surveySchedule": {
"createdAt": "2020-10-21T07:47:04.074Z",
"createdBy": null,
"from": "2020-08-14",
"id": "dc146f39-5203-4369-ba5f-e92c8b041ad1",
"modifiedAt": "2020-12-09T10:00:02.175Z",
"modifiedBy": null,
"questionPerSession": 4,
"questionTime": [
"10:00",
"22:00"
],
"to": "2020-12-30"
},
"surveyTypeId": "8f5dbfd9-c138-4dee-b65d-98c102d47efe",
"userId": null
},
"surveyId": "dc146f39-5203-4369-ba5f-e92c8b041ad1",
"tScore": "58.5",
"to": "2020-12-30"
}]}