title: Convert String data from mysql table to json list in java
body: <p>I want to convert a string to json list. I am currently working on a web api using spring boot. There is a table which contains multiple value at a ssingle column and similarly all the columns are having multi values. Like: There is a car company. There is a column named models - which contains more than one models and then there there is a price column which contains all the models price respectively.
  Now I have to convert those strings to json format. </p>
  
  <p>I tried using the <code>split()</code> in java for that but that is giving the address location as output. </p>
  
  <p>Model class</p>
  
  <pre><code>..........//getters and setters and declarations
  
      @Override
      public String toString() {
  
          String ar = car_type;
          String ar1[]=ar.split(",");
          int l = ar1.length;
          return "{" +
                  "\"car_comp\":" +"\"" + car_comp+ "\""+"," +
                  "\"car_type\":" +"\""+ ar1 + "\""+","+
                  "\"car_price\":" +"\""+ car_price+ "\""+","+
                  "\"car_comp_value\":"+"\"" + car_comp_value +"\""+
                  '}';
      }
  </code></pre>
  
  <p>I used the length function to check whether the array is being created of the right size or not.</p>
  
  <p>The Output</p>
  
  <pre><code> "car_comp": {
          "car_comp": "bmw",
          "car_type": "[Ljava.lang.String;@4017b770",
          "car_price": "$1500",
          "car_comp_value": "$65.4M"
      }
  </code></pre>
  
  <p>PLEASE IGNORE THE DATA..
  But the car type is showing not what I expected.
  To be honest this is my first time working in web api and json and I don't have much idea how to do things with it.
  The Expected Output :</p>
  
  <pre><code> "car_comp": {
          "car_comp": "bmw",
          "car_type": [{modelA},{modelB},{modelC}],
          "hb_unit_hints": "Kg",
          "hb_value": "65.4"
      }
  </code></pre>
  
  <p>Thanks in Advance.</p>