convert excel to json file
<p>I'm new in creating jsons and having bais knowledge of java.
I'm trying to convert database table data to json.</p>

<p>Having option to store table data in any format of file than convert that into json.</p>

<p>Here is my table data. </p>

<p>Table: PKGS</p>

<pre><code>    Price,   pd,          Id,                 Level
  1    , 266     ,    59098      ,         5
  2    , 247     ,    59098      ,         5
</code></pre>

<p>I want my table data in this json format. Its just an example...to show level in JSON</p>

<pre><code>"Id":59098
          "pd":266
                  "Level":5
                  "price":1
"Id":59098
          "pd":247
                  "Level":5
                  "price":2                                         
</code></pre>

<p>In this json there is two loops are going If am not wrong. I was able to do it for one loop in ETL..but couldnt do it for two loops.</p>

<p>Not getting values for reimbursementId and  packageId</p>

<p>Have goggled alot but couldn't find any code to understand properly and approach for the same.</p>

<p>Code tried little bit</p>

<pre><code>FileInputStream inp = new FileInputStream("D:/json.xlsx" );
Workbook workbook = WorkbookFactory.create( inp );

Sheet sheet = workbook.getSheetAt( 0 );

    JSONObject json = new JSONObject();

    JSONArray rows = new JSONArray();
</code></pre>

<p>but dont know what to next !!</p>

<p>can anyone tell me how to do this ? </p>