使用lua CJSON库如何将空table编码成数组
来源:互联网 发布:三国群英传2数据修改器 编辑:程序博客网 时间:2024/05/18 09:40
先看下面一段代码
local cjson = require "cjson" print(cjson.encode({dogs = {}})) -- 输出 {"dogs":{}}
lua的CJSON库默认会将空table编码成{},如果dogs是一个数组呢?当dogs为空的时候,如何让它返回一个空数组?很简单,加多一句代码就可以了
local cjson = require "cjson" cjson.encode_empty_table_as_object(false) print(cjson.encode({dogs = {}})) -- 输出 {"dogs":[]}
0 0
- 使用lua CJSON库如何将空table编码成数组
- Lua CJSON安装和使用
- lua-cjson安装与使用
- Lua CJSON安装和使用
- Lua CJSON安装和使用
- cocos2dx lua 3.10 使用cjson
- 如何将伪数组转换成数组
- lua table判空
- linux 下如何使用cJSON库
- cJSON库如何在KIEL4上使用?
- Lua cjson库在windows下的编译与使用
- 使用Lua CJSON库进行encode与decode操作
- 将字符串分割成数组(仅支持utf8编码)
- lua table中如何判断为空表
- lua cjson
- linux下编译使用lua及cjson
- linux下编译使用lua及cjson
- cJson库的使用
- MXNet学习
- WebView简介(联网权限)
- @RequestBody, @ResponseBody 注解详解
- Android Studio如何发布APK
- java.util.concurrent翻译----Executor框架--类ThreadPoolExecutor
- 使用lua CJSON库如何将空table编码成数组
- XML文件解析之Pull解析
- MyeclipseSVN插件安装
- algorithm 1.3.10
- jdbc连接数据库的步骤(面试题)
- Unity WebPlayer自定义进度条界面
- Android.mk编译APK范例
- SQL语句整理
- 二叉树中两个节点的最近公共祖先节点