How to apply an x-path into an array.
below is the sample JSON response, I want to get the documentid whose "subcategory" : "Loans" only
i tried below, didn't work out.
//documents/documentId[subcategory="Loans"]/text()
I want to apply a condition on subcategory field and retrieve only document id which satisfy the condition mentioned.
{
"documents" : [
{
"documentId" : "FO85L_rlLqZbYIKYznec2kazlBDVh7zcvQeJ9ocxYPLlqd_LRYIHTqPg6q8",
"formName" : "Entente relative au prêt personnel CIBC",
"ingestionDate" : "2017-02-03",
"fileSize" : 205820,
"note" : "Different",
"mimeType" : "application/pdf",
"products" : [
{
"accountNumber" : "0007508061",
"transitNumber" : "00153",
"closedDate" : null,
"category" : "LENDING",
"subcategory" : "Loans"
}
]
},
{
{ "documentId" : "nVr94RcSPG7b03E6b-7SvK9HbIyg3Vr53nAqmKipEtR2j87DzHi3bjosEK7r", "formName" : "Demande de fermeture de compte pour consolidation de dettes", "ingestionDate" : "2017-02-03", "fileSize" : 88552, "note" : "Demande de fermeture de compte pour consolidation de dettes", "mimeType" : "application/pdf", "products" : [ { "accountNumber" : "6244831", "transitNumber" : "00153", "closedDate" : null, "category" : "LENDING", "subcategory" : "PLC" } ] }, { ] } ]
}
Comments
-
Try /root/documents/item/documentId[../products/item/subcategory/text()="Loans"]/text()
2 -
Thank You Jakubiak..:)
0