converting CSV/XLS to JSON?


Does anyone know if there is application that will let me convert preferably XLS to JSON?

I'll also settle for a converter from CSV since that's what I'll probably end up having to write myself if there is nothing around.

10/29/2018 3:06:46 PM

Accepted Answer

This worked perfectly for me and does NOT require a file upload:

1/27/2014 12:03:37 PM

Since Powershell 3.0 (shipped with Windows 8, available for Windows 7 and windows Server 2008 but not Windows Vista ) you can use the built-in convertto-json commandlet:

PS E:> $topicsjson = import-csv .\itinerary-all.csv | ConvertTo-Json 

PS E:\> $topicsjson.Length

PS E:\> $topicsjson.getType()

IsPublic IsSerial Name                                     BaseType                  
-------- -------- ----                                     --------                  
True     True     Object[]                                 System.Array              

Online Help Page on Technet


If you can't find an existing solution it's pretty easy to build a basic one in Java. I just wrote one for a client and it took only a couple hours including researching tools.

Apache POI will read the Excel binary.

JSONObject will build the JSON

After that it's just a matter of iterating through the rows in the Excel data and building a JSON structure. Here's some pseudo code for the basic usage.

FileInputStream inp = new FileInputStream( file );
Workbook workbook = WorkbookFactory.create( inp );

// Get the first Sheet.
Sheet sheet = workbook.getSheetAt( 0 );

    // Start constructing JSON.
    JSONObject json = new JSONObject();

    // Iterate through the rows.
    JSONArray rows = new JSONArray();
    for ( Iterator<Row> rowsIT = sheet.rowIterator(); rowsIT.hasNext(); )
        Row row =;
        JSONObject jRow = new JSONObject();

        // Iterate through the cells.
        JSONArray cells = new JSONArray();
        for ( Iterator<Cell> cellsIT = row.cellIterator(); cellsIT.hasNext(); )
            Cell cell =;
            cells.put( cell.getStringCellValue() );
        jRow.put( "cell", cells );
        rows.put( jRow );

    // Create the JSON.
    json.put( "rows", rows );

// Get the JSON text.
return json.toString();

This works for me and runs client-side:


I just found this:

( Note: you have to have your csv file available via a web address )


Take a try on the tiny free tool:

It utilises node.js csvtojson module


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Email: [email protected]