Json is a very commonly used data format in program development. For programmers, there is no problem in reading and editing Json, but it is not so convenient for others. For example, configuring game data: the names of game characters, skills, and props, and planning documents are often configured through Excel, which is more convenient to set up. But when the program runs, Excel needs to be converted to Json.

Project Description

This is an Excel-to-Json tool developed based on C#, which is 100 times faster than accessing data through Office Excel components, and supports interface and command modes.

Technology Architecture

1. Visual Studio 2012, .Net Framework 4.0

Project structure

picture

The main function

  1. Support reading Excel 97-2003 .xls format and 2007 .xlsx format;

  2. Support multiple form export;

  3. Convert the Excel form to a Json object and save it to a text file. Supports converting the contents of the table into an Array, or a dictionary object with the ID of the first column;

  4. Generate C# structure definition code from header information;

  5. Advanced Features

  6. Exclude forms or columns by specific prefix

  7. Automatically identify and convert Json format strings in cells, and convert them into Json Array or Json Object

How to use

Support command mode and interface operation mode

1. Command mode

command line arguments

  • -e, --excel Required. Enter the path to the Excel file.

  • -j, --json Specifies the path to the output json file.

  • -h, --header Required. Several rows in the table are headers.

  • -c, --encoding (Default: utf8-nobom) Specifies the name of the encoding.

  • -l, --lowcase (Default: false) Automatically convert field names to lowercase.

  • -a serialize into an array

  • -d, --date: Specify a date format string, for example: dd / MM / yyy hh: mm:ss

  • -s Force sheet name when serializing, even if there is only one sheet

  • -exclude_prefix: When exporting, exclude forms and columns containing the specified prefix, for example: -exclude_prefix #

  • -cell_json: Automatically identify Json objects and Json arrays in cells, Default: false

@SET EXCEL_FOLDER=.\excel@SET JSON_FOLDER=.\json@SET EXE=.\excel2json.exe
@ECHO Converting excel files in folder %EXCEL_FOLDER% ...for /f "delims=" %%i in ('dir /b /a-d /s %EXCEL_FOLDER%\*.xlsx') do ( @echo processing %%~nxi @CALL %EXE% --excel %EXCEL_FOLDER%\%%~nxi --json %JSON_FOLDER%\%%~ni.json --header 3)

2. Interface mode

picture

picture

How to get it: Click on the public number card below and follow me

Reply " 1038 " for link