I a have dynamically changing json like in below examples
Example 1:
"Flower":{
"color": "red"
}
Example 2:
"Flower":{
"color": "red" ,
"seasonal": "yes"
}
Example 3:
"Flower":{
"color": "red" ,
"seasonal": {
"seasons":{
"winter": "yes",
"summer" : "no"
}
}
}
and for the above examples output should be like
example1 : color:red
example2 :color:red,seasonal:yes
example3: color:red,seasonal.seasons.winter:yes,seasonal.seasons.summer:no
Problem here is dont know what comes everytime, it should be of output format. I need some piece of logic of this in javascript :(