Code Monkey home page Code Monkey logo

exceltojson's Introduction

ExcelToJson

Excel Convert To Json Object

这是一个将Excel表格转换为Json Object的转换器,你可以拿到你想要的任何结构的数据对象

此转换器并附带转换为Json文本的方法, 你也可以很方便的拓展这个转换器,以你想要的方式导出为任意格式

安装

Unity

  1. 在PackageManager中添加 com.unity.nuget.newtonsoft-json 包
  2. 下载并使用ExcelToJson.unitypackage

Unity PacakgeManager

  1. add package from git: https://github.com/ztail/ExcelToJson.git?path=ExcelToJson-Unity/Assets#main

如何使用

var converter = new ExcelConverter();
using (var excelReader = converter.ReadExcel(filePath))
{
	excelReader.ReadSheet(sheetName)?.Convert(postprocessor).Apply(key);
}

自定义类型

converter.RegisterLocalType(typeName, tpyeConveter);

表格配置

ID 名字 标记1 标记2
&ID.name &ID.mark.#0 &ID.mark.#1
number string number number
1 熊大 1 2
2 熊二 3 4

输出

{
	"1": {
		"name": "熊大",
		"mark": [1, 2]
	},
	"2": {
		"name": "熊二",
		"mark": [3, 4]
	}
}

字段标识

# 数组索引标记,父对象将自动生成为数组

& 引用标记,该字段值将自动转换为同一行对应列的单元格的值

. 分割标记,可将结构体进行嵌套

exceltojson's People

Contributors

qq792453582 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.