资源简介
基于C语言的json编解码工具,可直接移植到stm32等单片机上,调用.h中函数即可编解码,方便移植使用
代码片段和文件信息
/*
Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
Permission is hereby granted free of charge to any person obtaining a copy
of this software and associated documentation files (the “Software“) to deal
in the Software without restriction including without limitation the rights
to use copy modify merge publish distribute sublicense and/or sell
copies of the Software and to permit persons to whom the Software is
furnished to do so subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS“ WITHOUT WARRANTY OF ANY KIND EXPRESS OR
IMPLIED INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM DAMAGES OR OTHER
LIABILITY WHETHER IN AN ACTION OF CONTRACT TORT OR OTHERWISE ARISING FROM
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/* cJSON */
/* JSON parser in C. */
/* disable warnings about old C89 functions in MSVC */
#if !defined(_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER)
#define _CRT_SECURE_NO_DEPRECATE
#endif
#ifdef __GNUC__
#pragma GCC visibility push(default)
#endif
#if defined(_MSC_VER)
#pragma warning (push)
/* disable warning about single line comments in system headers */
#pragma warning (disable : 4001)
#endif
#include
#include
#include
#include
#include
#include
#ifdef ENABLE_LOCALES
#include
#endif
#if defined(_MSC_VER)
#pragma warning (pop)
#endif
#ifdef __GNUC__
#pragma GCC visibility pop
#endif
#include “cJSON.h“
/* define our own boolean type */
#ifdef true
#undef true
#endif
#define true ((cJSON_bool)1)
#ifdef false
#undef false
#endif
#define false ((cJSON_bool)0)
typedef struct {
const unsigned char *json;
size_t position;
} error;
static error global_error = { NULL 0 };
CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void)
{
return (const char*) (global_error.json + global_error.position);
}
CJSON_PUBLIC(char *) cJSON_GetStringValue(cJSON *item) {
if (!cJSON_IsString(item)) {
return NULL;
}
return item->valuestring;
}
/* This is a safeguard to prevent copy-pasters from using incompatible C and header files */
#if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 7) || (CJSON_VERSION_PATCH != 12)
#error cJSON.h and cJSON.c have different versions. Make sure that both have the same.
#endif
CJSON_PUBLIC(const char*) cJSON_Version(void)
{
static char version[15];
sprintf(version “%i.%i.%i“ CJSON_VERSION_MAJOR CJSON_VERSION_MINOR CJSON_VERSION_PATCH);
return version;
}
/* Case insensitive string comparison doesn‘t consider two NULL pointers equal though */
static int case_insensitive_strcmp(const unsigned char
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-09-03 09:38 基于单片机的json编解码源码\
文件 74183 2019-08-28 20:57 基于单片机的json编解码源码\cJSON.c
文件 15134 2019-08-28 20:57 基于单片机的json编解码源码\cJSON.h
相关资源
- mpu9250九轴姿态用STM32F103实现I2C通信
- TCP/IP聊天室群聊MFC版
- ConvDBC_TO_Code.tar.gz
- DSM501A基于51单片机code
- [C++大学教程 C++ How to program(第九版)
- c++primer 第五版 源代码
- C语言课程设计_太空战机提高篇funco
- 基于STM32F4的加速度频域二次积分振动
- C实现数字转Unicode码
- 免费的LeetCode-cpp题解(C++版本)大全
- codeblocks-17.12mingw-setup网盘
- STM32F3 LCD1602 I2C驱动代码 C语言
- vs code C/C++语法高亮配置文件C/C++ The
- eclipse codetemplates and codeFormatter
- DMDECODER二维码识别MFC工程
- C语言程序设计 现代方法 第二版 源代
-
ob
jective-C在XCode上调用C++的代码 -
Jli
nk 命令行自动程序 - stm32f103的TCS34725驱动分享
- Qrcode二维码生成C++
- C++Builder XE 10.3(二维码).rar
- SDL ttf 中文 C/C++ source code
- LeetCode 题解 C++ 版 高清.pdf版
- BenCode编码解析
- leetcode全部题解
- 昆仑通态屏做主机与STM32单片机从机之
- MAX30102心率血氧显程-STM32F103C8T6-C语言
- 51单片机生成二维码(QR Code)+12864并
- libstd++.6 和 libstd++.6.0.9
- stdc++.6.0.9
评论
共有 条评论