Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Excel to Json tool (Resource allocation Foundation)

Shulou Source: shulou.com Published: 2022-06-03 06:53:28 09月22日 Update

First, the 1.0.0.0 version of the tool features:

①, field types are supported (int / float / string / bool / int [] / float [] / string [] / bool [])

②, supporting front-end / back-end differential configuration

③, support specification sheet

④, which supports changing the encoding method

⑤ with support for expanding / shrinking attribute structures

⑥, which supports Array mode

⑦, which supports multiple sheet configurations

⑧, other basic functions

Second, how to use ①. This tool is run using the DOS command, as shown in the figure below:

Now explain the various commands:

1`-e or-- excel (the following is a short command only): the relative position of excel

2`-j: the name of the exported json 3`-h: the number of lines of the sheet header (I suggest using 5) 4`-c: encoding method 5`-l: whether the field name is converted to lowercase 6`-a: whether to use Array mode 7`-Q: whether to configure the front end 8`-I: whether the last sheet is the instruction manual (if so, do not export config) 9`-o: whether the exported json is a tree structure deployment

②, about the location of the resource

If relative to the AonauflyConfig.exe sibling directory, use-- excel xxx.xlsx and-- json xxx.json directly

If not, use.. / etc correspondingly to get the relative directory

③, give several commands (you need to open the cmd window in the AonauflyConfig.exe sibling directory)

1: AonauflyConfig-excel test.xlsx-json test.json-header 5-qianduan true-instruction true-open true

Meaning: import test.xlsx to sibling directory test.json; the number of header lines in sheet is 5; front-end configuration; tree structure expansion

2: AonauflyConfig-excel test.xlsx-json test.json-header 5-array false-qianduan true-instruction true

Meaning: test.xlsx to the sibling directory test.json; the number of header lines of sheet is 5; Array mode; front-end configuration; the last sheet is the description table (not printed)

Third, look at the configuration of excel

1`first line (fixed): field name

2`second line (fixed): field type

3`3rd line (fixed): back end (Y: print / N: do not print)

4`4th line (fixed): front end (Y: print / N: do not print)

5` ~ n fill in at will

4. View the printed front-end data as follows: {"Model": {"1": {"id": 1, "description": "strength", "agility": 10, "brains": 10, "initHp": 200,100,100,5.0,2.5,2.5,2.5,300 "speed". "skillIdList": [1,2,3,4,5,6,7,8,9]}, "2": {"id": 2, "description": "agile", "agility": 25, "brains": 10, "initHp": 125,175 "initMagic", "powerIncrease": 2.5 "agilityIncrease": 5.0,2.5 "brainsIncrease", "speed": 400," skillIdList ": [1,2,3,4,5,6,7,8,10]}," 3 ": {" id ": 3," description ":" intellectual "," agility ": 10," brains ": 25 "initHp": 100,200 "initMagic", "powerIncrease": 2.5,2.5 "agilityIncrease", "brainsIncrease": 5.0,300 "speed", "skillIdList": [1,2,3,4,5,6,7,8,11]}, "4": {"id": 4 "description": "stress sensitive", "agility": 18, "brains": 9, "initHp": 175,125,125," powerIncrease ": 4.0," agilityIncrease": 4.0,2.0,350,350,4,5,6,7,8 12]}, "5": {"id": 5, "description": "smart", "agility": 18, "brains": 18, "initHp": 125,175,2.0," agilityIncrease ": 4.0,4.0,350,350" skillIdList ": [1,2,3] 4, 5, 6, 7, 8, 13]}, "6": {"id": 6, "description": "intellectual", "agility": 9, "brains": 18, "initHp": 175," initMagic ": 125," powerIncrease ": 4.0,2.0,4.0" brainsIncrease " "speed": 300, "skillIdList": [1,2,3,4,5,6,7,8,14]}, "7": {"id": 7, "description": "comprehensive", "agility": 15, "brains": 15, "initHp": 150, "initMagic": 150 "powerIncrease": 3.33, "agilityIncrease": 3.33, "brainsIncrease": 3.33, "speed": 325, "skillIdList": [1,2,3,4,5,6,7,8,15]}

You can see that the sheet name serves as the title for each table of the config. And power field and xxx field are not available..

Fifth, reference

Https://github.com/neil3d/excel2json

I have extended and modified this code. Thanks to the almighty Internet.

Tags: Support configuration front end field method catalog sibling name command pattern structure tool location meaning title tree type code specification foundation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Shulou Technology Huawei Linux Shulou Information