title: Method put()-error in Java while putting data in JsonObject.
body: <p>I have a question about my error code. I am working on a project with Angular, Java, Spark and an SQL database. </p>
  
  <p>The method contains a prepared statement with an SQL Select statement. In the whileloop wants to go through as long as a result is found. Pack the queried data into a Json object, and these Json objects into a Json array.</p>
  
  <pre><code>import com.google.gson.JsonArray;
  import com.google.gson.JsonObject;
  import finanzplanpackage.connection.ConnectionConfiguration;
  
  import java.sql.PreparedStatement;
  import java.sql.ResultSet;
  import java.sql.SQLException;
  import java.lang.String;
  
  import java.util.logging.Level;
  import java.util.logging.Logger;
  
  
  
  public class n_paresmodul {
  
      private ConnectionConfiguration c = new ConnectionConfiguration();
  
      public String viewdata() {
          String data = "";
          JsonArray ja = new JsonArray();
          try{
          PreparedStatement pre = c.getconn().prepareStatement("SELECT * FROM n_pares");
          ResultSet res = pre.executeQuery();
          while (res.next()) {
              JsonObject jo = new JsonObject();
              jo.put("account_id", res.getInt("account_id"));
              jo.put("mandant_id", res.getInt("mandant_id"));
              jo.put("id", res.getInt("id"));
              jo.put("sourcedata", res.getString("sourcedata"));
              ja.add(jo);
          }
          data = ja.toString();
      } catch(
      SQLException ex)
  
      {
          Logger.getLogger(n_paresmodul.class.getName()).log(Level.SEVERE, null, ex);
      }
  
      return data;
  
  }
  </code></pre>
  
  <p>When compiling, the compiler throws me the following error message.</p>
  
  <p>symbol: method put (java. lang. String, int)
  location: variable jo of type com. google. gson.JsonObject</p>
  
  <p><a href="https://i.stack.imgur.com/QOPWs.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>Can someone please help me and tell me what I'm doing wrong with the put-method? </p>
  
  <p>thank you</p>