Skip to content

aronlt/MyCjson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MyCjson

采用C++语言重写了CJson.

重写内容:
1:Object类型采用Map存储子元素,可以方便查找对象
2:Array类型采用Vector存储子元素
3:采用vector替代char*,从而避免了繁琐的内存管理
使用方式:

#include <vector>
#include <iostream>
#include "cjson.h"
using namespace MyCJson
int main(){
	
	CBaseItem item;
	char *pTest = "{\n\"name\": \"Jack(\\\"Bee\\\") Nimble\", \n\"format\": {\"type\":       \"rect\", \n\"width\":      1920, \n\"height\":     1080, \n\"interlace\":  false,\"frame rate\": 24\n}\n}";
	item.PraseValue(pTest);
	CBaseItem::CHAR_VEC container;
	item.Print(container);
	for(auto elem: container){
	  std::cout << elem;
	}
	return 0;
}

测试结果如下:
结果

具体的使用方式见doc/API.md文件

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages