title: JSON Output Java
body: <p>I am writing a RESTful API program to deployed on AWS. I am getting JSON output from the program. When I testing the program, it return the JSON output which is not same as the expected output. The orientation, upper case and lower case also not correct as I want it to be.</p>
  
  <p>Expected Output:</p>
  
  <pre><code>[
    {
      "Username": "****",
      "UUID": "****",
      "Tenant_ID": "****",
      "Site_ID": "****"
    }
  ]
  </code></pre>
  
  <p>Output Received:</p>
  
  <pre><code>[
    {
      "UUID": "****",
      "site_ID": "****",
      "tenant_ID": "****",
      "userName": "****"
    }
  ]
  </code></pre>
  
  <p>Resource Code:</p>
  
  <pre><code>public List&lt;Data&gt; getData(){
      List&lt;Data&gt; list = new ArrayList&lt;&gt;();
      Connection conn = null;
      Statement stat = null;
      try{
          Class.forName("com.mysql.jdbc.Driver");
          conn = DriverManager.getConnection(DB_URL);
          stat = conn.createStatement();
          String sql = "SELECT * FROM data";
          ResultSet resu = stat.executeQuery(sql);
          while(resu.next()){
              String UserName = resu.getString("username");
              String UUID = resu.getString("UUID");
              String Tenant_ID = resu.getString("tenant_id");
              String Site_ID = resu.getString("site_id");
              list.add(new Data(UserName, UUID, Tenant_ID, Site_ID));
          }
          resu.close();
          stat.close();
          conn.close();
      }
      catch(SQLException se){
          se.printStackTrace();
      }
      catch(Exception e){
          e.printStackTrace();
      }
      finally{
          try{
              if(stat!=null){
                  stat.close();
              }
          }
          catch (SQLException se2){
              se2.printStackTrace();
          }
          try{
              if(conn!=null){
                  conn.close();
              }
          }
          catch(SQLException se3){
              se3.printStackTrace();
          }
      }
      return list;
  }
  </code></pre>
  
  <p>Service Code:</p>
  
  <pre><code>@Produces(MediaType.APPLICATION_JSON)
  @GET
  @Path("/v2")
  public List&lt;Data&gt; getData(){
      return ds.getData();
  }
  </code></pre>
  
  <p>Data Class:</p>
  
  <pre><code>public class Data {
      private String UserName;
      private String UUID;
      private String Tenant_ID;
      private String Site_ID;
  
      public Data(){
  
      }
  
      public Data(String userName, String uUID, String tenant_ID, String site_ID) {
          super();
          UserName = userName;
          UUID = uUID;
          Tenant_ID = tenant_ID;
          Site_ID = site_ID;
      }
  
      public Data(String uUID, String tenant_ID, String site_ID) {
          super();
          UUID = uUID;
          Tenant_ID = tenant_ID;
          Site_ID = site_ID;
      }
  
      @JsonProperty("Username")
      public String getUserName() {
          return UserName;
      }
  
      public void setUserName(String userName) {
          UserName = userName;
      }
  
      @JsonProperty("UUID")
      public String getUUID() {
          return UUID;
      }
  
      public void setUUID(String UUID) {
          this.UUID = UUID;
      }
  
      @JsonProperty("Tenant_ID")
      public String getTenant_ID() {
          return Tenant_ID;
      }
  
      public void setTenant_ID(String tenant_ID) {
          Tenant_ID = tenant_ID;
      }
  
      @JsonProperty("Site_ID")
      public String getSite_ID() {
          return Site_ID;
      }
  
      public void setSite_ID(String site_ID) {
          Site_ID = site_ID;
      }
  }
  </code></pre>
  
  <p>Thanks for every member that help on this question.</p>