GithubHelp home page GithubHelp logo

jjson's Introduction

jjson

mini json,one header file. easy to use.

jjson::obj_t vec;
jjson::json_t obj;
obj["str"] = "**人";
obj["bool"] = false;

vec.add(1);
vec.add(false);


json1["str"] = "**人";
json1["int"] = 12345;
json1["bool"] = false;
json1["float"] = 0.1;

json1["vec1"] = vec;
json1["vec"].add(1);
json1["vec"].add(2);
json1["vec"].add(3);
json1["vec"].add(4);
json1["vec"].add("hello world");
json1["vec"].add(false);
json1["vec"].add(true);
json1["vec"].add(jjson::null);

json1["vec"].add(obj);
json1["vec"].add(vec);

json2["vec"] = json1;
json2["obj1"]["obj1"] = 1;
json2["obj1"]["obj2"] = false;
json2["obj1"]["obj3"] = 0.1;
json2["obj1"]["obj4"] = vec;
json2["obj1"]["obj5"]["ob1"] = false;
json2["obj1"]["obj5"]["ob2"] = 1;
json2["obj1"]["obj5"]["ob3"] = json1;

str = json2.to_string();

  this json:
  {
    "obj1": {
	"obj1": 1,
	"obj2": false,
	"obj3": 0.1,
	"obj4": [
	    1,
	    false
	],
	"obj5": {
	    "ob1": false,
	    "ob2": 1,
	    "ob3": {
		"bool": false,
		"float": 0.1,
		"int": 12345,
		"str": "**人",
		"vec": [
		    1,
		    2,
		    3,
		    4,
		    "hello world",
		    false,
		    true,
		    null,
		    {
			"bool": false,
			"str": "**人"
		    },
		    [
			1,
			false
		    ]
		],
		"vec1": [
		    1,
		    false
		]
	    }
	}
    },
    "vec": {
	"bool": false,
	"float": 0.1,
	"int": 12345,
	"str": "**人",
	"vec": [
	    1,
	    2,
	    3,
	    4,
	    "hello world",
	    false,
	    true,
	    null,
	    {
		"bool": false,
		"str": "**人"
	    },
	    [
		1,
		false
	    ]
	],
	"vec1": [
	    1,
	    false
	]
    }
}

jjson's People

Contributors

akzi avatar

Watchers

James Cloos 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.