title: How to read nested properties from configuration file in java
body: <p>I want to read Name property from configuration file. I want my config file to look like this:</p>
  
  <p>config.properties</p>
  
  <pre><code>Person{
    Name= ABC
    PhoneNumber=123
        }
  Address{     
    Pin=500
         } 
  </code></pre>
  
  <p>I tried </p>
  
  <pre><code>public Properties readConfiguration()
  {
      File configFile1 = new File("config.properties");
  
      try {
          FileReader reader = new FileReader(configFile1);
          Properties props = new Properties();
          props.load(reader);
  
          reader.close();
          return props;
      } catch (FileNotFoundException ex) {
          // file does not exist
      } catch (IOException ex) {
          // I/O error
      }
  
      return null;
  }
  </code></pre>
  
  <p>But this function will read only key value pairs and its unable to read nested properties. So what should i use to read nested properties?</p>
  
  <p>Please help me find the solution to read nested properties.</p>