Reputation: 94
I have a JSON response like below and I only want to extract text following text from file using extracttext processor in NIFI. But, it is saying not a valid Java expression.
"17" : {
"columnId" : 17,
"columnName" : "id",
"value" : "1234:;5678"
}
"17" : {
"columnId" : 17,
"columnName" : "id",
"value" : "1234:;5678"
},
"19" : {
"columnId" : 19,
"columnName" : "HelloWorld",
"value" : "Test 1:;34130"
},
"21" : {
"columnId" : 21,
"columnName" : "Testing",
"value" : "Test"
}
"17" : {
"columnId" : 17,
"columnName" : "id",
"value" : "1299:;6775"
},
"19" : {
"columnId" : 19,
"columnName" : "HelloWorld",
"value" : "Test 2.:;34147"
},
"21" : {
"columnId" : 21,
"columnName" : "Testing",
"value" : "Test"
}
"17" : {
"columnId" : 17,
"columnName" : "id",
"value" : "1299:;6775"
},
"19" : {
"columnId" : 19,
"columnName" : "HelloWorld",
"value" : "Test.:;34147"
},
"21" : {
"columnId" : 21,
"columnName" : "globalregions",
"value" : "Test"
}
"
I have tried expression:
"17" : {(.*?)\}.
It's not working.
Expected result should be :-
"17" : {
"columnId" : 17,
"columnName" : "id",
"value" : "1234:;5678"
}
"17" : {
"columnId" : 17,
"columnName" : "id",
"value" : "1299:;6775"
}
Upvotes: 0
Views: 4457
Reputation: 28634
normally you should have unique keys for json object.
and in your json there are several keys "17"
in the same object...
however the following regexp should work for your json: "17"\s*:\s*\{[^}]*\}
you can try it: https://regex101.com/r/8RiPHu/1/
Upvotes: 2