title: How to create String Format template to generate Json for Eclipse autogenerated toString
body: <p>Eclipse gave option to auto generate the toString method for every class.</p>
  
  <p>Further leverage this facility, I am creating String Format Template to give as Json format when eclipse generate toString Method.</p>
  
  <p>I used following String Format Template:</p>
  
  <pre><code> { ${member.name()}:"${member.value}", ${otherMembers}}
  </code></pre>
  
  <p>now i generated toString method as following POJO but When i run this program i got result as and not a VALID JSON.</p>
  
  <pre><code>{ name:"null", reportees:"[1, 2, 3]", department:"[retail, banking, finance]", owns:"null", supplimentary:"null}
  </code></pre>
  
  <p>Code</p>
  
  <pre><code>public class TestPojo {
    private String name;
    private List&lt;String&gt; reportees;
    private String[] department;
    private Machine owns;
    private List&lt;Machine&gt; supplimentary;
  
  public static void main(String arg[]) {
      TestPojo aTestPojo = new TestPojo();
      aTestPojo.department = new String[] { "retail", "banking", "finance" };
      aTestPojo.reportees = new ArrayList&lt;String&gt;() {
  
          {
              add("1");
              add("2");
              add("3");
          }
      };
      System.out.print(aTestPojo);
  }
  
  public static class Machine {
  
      private String machineName;
      private String duties;
  
      public String getMachineName() {
          return machineName;
      }
  
      public void setMachineName(String machineName) {
          this.machineName = machineName;
      }
  
      public String getDuties() {
          return duties;
      }
  
      public void setDuties(String duties) {
          this.duties = duties;
      }
  
      @Override
      public String toString() {
          StringBuilder builder = new StringBuilder();
          builder.append("{ machineName:\"").append(machineName).append("\", duties:\"").append(duties).append("}");
          return builder.toString();
      }
  
  }
  
  @Override
  public String toString() {
      StringBuilder builder = new StringBuilder();
      builder.append("{ name:\"").append(name).append("\", reportees:\"").append(reportees).append("\", department:\"").append(Arrays.toString(department)).append("\", owns:\"").append(owns).append("\", supplimentary:\"").append(supplimentary).append("}");
      return builder.toString();
  }
  </code></pre>
  
  <p>}</p>