title: Get Values from nested Json Object
body: <p>I have a nested json format like given below,I need to read all the nodes till the last node to get the node name, node value, attribute name, parent node. I tried using a recursive function to read data but its not working correctly. Please help with a simple solution to read data. (precisely a dynamic one which can handle any number of nodes and attributes)</p>
  
  <p><strong>Required Output format</strong></p>
  
  <pre><code>   name     |   Value        | IsNode | Parent
  ------------------------------------------------
   updated    2014-01-01  false   record
   position   ambassador  true    record/person
   first_name Eliyahu     true    record/person/names
   alias      Eli         true    record/person/names/aliases
   country    ISRAEL      true    record/details/countries
   category   DIPLOMAT    false   record
  </code></pre>
  
  <p><strong>Json Input format</strong></p>
  
  <pre><code>{
    "Node": "record",
    "NodeValue": null,
    "ParentNode": "records",
    "Nodes": [
      {
        "Node": "person",
        "NodeValue": null,
        "ParentNode": "record",
        "Nodes": [
          {
            "Node": "title",
            "NodeValue": "Dr",
            "ParentNode": "person",
            "Nodes": [
  
            ],
            "Attributes": [
  
            ]
          },
          {
            "Node": "position",
            "NodeValue": "Ambassador",
            "ParentNode": "person",
            "Nodes": [
  
            ],
            "Attributes": [
  
            ]
          },
          {
            "Node": "names",
            "NodeValue": null,
            "ParentNode": "person",
            "Nodes": [
              {
                "Node": "first_name",
                "NodeValue": "Eliyahu",
                "ParentNode": "names",
                "Nodes": [
  
                ],
                "Attributes": [
  
                ]
              },
              {
                "Node": "last_name",
                "NodeValue": "BEN TURA",
                "ParentNode": "names",
                "Nodes": [
  
                ],
                "Attributes": [
  
                ]
              },
              {
                "Node": "aliases",
                "NodeValue": null,
                "ParentNode": "names",
                "Nodes": [
                  {
                    "Node": "alias",
                    "NodeValue": "BEN TURA,Eli",
                    "ParentNode": "aliases",
                    "Nodes": [
  
                    ],
                    "Attributes": [
  
                    ]
                  }
                ],
                "Attributes": [
  
                ]
              },
              {
                "Node": "alternative_spelling",
                "NodeValue": null,
                "ParentNode": "names",
                "Nodes": [
  
                ],
                "Attributes": [
                  {
                    "Key": "{http://www.w3.org/2001/XMLSchema-instance}nil",
                    "Value": "true"
                  }
                ]
              }
            ],
            "Attributes": [
  
            ]
          },
          {
            "Node": "agedata",
            "NodeValue": null,
            "ParentNode": "person",
            "Nodes": [
              {
                "Node": "age",
                "NodeValue": null,
                "ParentNode": "agedata",
                "Nodes": [
  
                ],
                "Attributes": [
                  {
                    "Key": "{http://www.w3.org/2001/XMLSchema-instance}nil",
                    "Value": "true"
                  }
                ]
              },
              {
                "Node": "as_of_date",
                "NodeValue": null,
                "ParentNode": "agedata",
                "Nodes": [
  
                ],
                "Attributes": [
                  {
                    "Key": "{http://www.w3.org/2001/XMLSchema-instance}nil",
                    "Value": "true"
                  }
                ]
              },
              {
                "Node": "dob",
                "NodeValue": null,
                "ParentNode": "agedata",
                "Nodes": [
  
                ],
                "Attributes": [
                  {
                    "Key": "{http://www.w3.org/2001/XMLSchema-instance}nil",
                    "Value": "true"
                  }
                ]
              },
              {
                "Node": "deceased",
                "NodeValue": null,
                "ParentNode": "agedata",
                "Nodes": [
  
                ],
                "Attributes": [
                  {
                    "Key": "{http://www.w3.org/2001/XMLSchema-instance}nil",
                    "Value": "true"
                  }
                ]
              }
            ],
            "Attributes": [
  
            ]
          }
        ],
        "Attributes": [
          {
            "Key": "ssn",
            "Value": ""
          },
          {
            "Key": "e-i",
            "Value": "M"
          }
        ]
      },
      {
        "Node": "details",
        "NodeValue": null,
        "ParentNode": "record",
        "Nodes": [
          {
            "Node": "passports",
            "NodeValue": null,
            "ParentNode": "details",
            "Nodes": [
              {
                "Node": "passport",
                "NodeValue": null,
                "ParentNode": "passports",
                "Nodes": [
  
                ],
                "Attributes": [
                  {
                    "Key": "country",
                    "Value": ""
                  },
                  {
                    "Key": "{http://www.w3.org/2001/XMLSchema-instance}nil",
                    "Value": "true"
                  }
                ]
              }
            ],
            "Attributes": [
  
            ]
          },
          {
            "Node": "place_of_birth",
            "NodeValue": null,
            "ParentNode": "details",
            "Nodes": [
  
            ],
            "Attributes": [
              {
                "Key": "{http://www.w3.org/2001/XMLSchema-instance}nil",
                "Value": "true"
              }
            ]
          },
          {
            "Node": "locations",
            "NodeValue": null,
            "ParentNode": "details",
            "Nodes": [
              {
                "Node": "location",
                "NodeValue": null,
                "ParentNode": "locations",
                "Nodes": [
  
                ],
                "Attributes": [
                  {
                    "Key": "country",
                    "Value": "SENEGAL"
                  },
                  {
                    "Key": "city",
                    "Value": "Dakar"
                  },
                  {
                    "Key": "state",
                    "Value": "Dakar"
                  },
                  {
                    "Key": "{http://www.w3.org/2001/XMLSchema-instance}nil",
                    "Value": "true"
                  }
                ]
              }
            ],
            "Attributes": [
  
            ]
          },
          {
            "Node": "countries",
            "NodeValue": null,
            "ParentNode": "details",
            "Nodes": [
              {
                "Node": "country",
                "NodeValue": "ISRAEL",
                "ParentNode": "countries",
                "Nodes": [
  
                ],
                "Attributes": [
  
                ]
              }
            ],
            "Attributes": [
  
            ]
          },
          {
            "Node": "companies",
            "NodeValue": null,
            "ParentNode": "details",
            "Nodes": [
              {
                "Node": "company",
                "NodeValue": null,
                "ParentNode": "companies",
                "Nodes": [
  
                ],
                "Attributes": [
                  {
                    "Key": "{http://www.w3.org/2001/XMLSchema-instance}nil",
                    "Value": "true"
                  }
                ]
              }
            ],
            "Attributes": [
  
            ]
          },
          {
            "Node": "keywords",
            "NodeValue": null,
            "ParentNode": "details",
            "Nodes": [
              {
                "Node": "keyword",
                "NodeValue": null,
                "ParentNode": "keywords",
                "Nodes": [
  
                ],
                "Attributes": [
                  {
                    "Key": "{http://www.w3.org/2001/XMLSchema-instance}nil",
                    "Value": "true"
                  }
                ]
              }
            ],
            "Attributes": [
  
            ]
          }
        ],
        "Attributes": [
  
        ]
      }
    ],
    "Attributes": [
      {
        "Key": "category",
        "Value": "DIPLOMAT"
      },
      {
        "Key": "editor",
        "Value": ""
      },
      {
        "Key": "entered",
        "Value": "2010-11-19"
      },
      {
        "Key": "sub-category",
        "Value": "PEP"
      },
      {
        "Key": "uid",
        "Value": "1389120"
      },
      {
        "Key": "updated",
        "Value": "2014-01-01"
      }
    ]
  }
  </code></pre>