Support Questions

Find answers, ask questions, and share your expertise

Get the key of JSON based on nested value using Nifi

avatar
Explorer

Hi
I want to get the key of JSON based on nested value

EXAMPLE JSON

{
	"menu": {
		"id": "file",
		"value": "File",
		"sample1": {
			"menuitem": {
				"value": "Done",
				"onclick": "CreateNewDoc()"
			}

		},
		"sample2": {
			"menuitem": {
				"value": "New",
				"onclick": "CreateNewDoc()"
			}

		},
		"sample3": {
			"menuitem": {
				"value": "New",
				"onclick": "CreateNewDoc()"
			}

		}
	}
}


I want to have the first sample* where the menu.sample*.menuitem.value = New

based on the example JSON the return value should be "sample2"


Another example 

{
	"menu": {
		"id": "file",
		"value": "File",
		"sample1": {
			"menuitem": {
				"value": "Done",
				"onclick": "CreateNewDoc()"
			}

		},
		"sample2": {
			"menuitem": {
				"value": "Done",
				"onclick": "CreateNewDoc()"
			}

		},
		"sample3": {
			"menuitem": {
				"value": "New",
				"onclick": "CreateNewDoc()"
			}

		}
	}
}



The return value should be "sample3"

 Is this applicable using Nifi

 

0 REPLIES 0