//rapidjson needs:
#include "rapidjson/writer.h"
#include "rapidjson/stringbuffer.h"
#include <iostream>
using namespace rapidjson;
using namespace std;


	StringBuffer json_string_buffer;
	Writer<StringBuffer> json_writer(json_string_buffer);

	json_writer.StartObject();		//<<<There must be a root object surrounding everything

		json_writer.Key("name1");
		json_writer.Uint(1);
		
		json_writer.Key("name2");
		json_writer.Uint(2);
		
		//A simple array
		json_writer.Key("MyArrayOfThings");
		json_writer.StartArray();
		for (i = 0; i< 3; i++)
		{
			json_writer.Uint(1));
		}
		json_writer.EndArray();

		//A simple Key + Value array
		json_writer.Key("MyArrayOfThings");
		json_writer.StartObject();
		for (i = 0; i< 3; i++)
		{
			json_writer.Key("Something");
			json_writer.Uint(i + 10));
		}
		json_writer.EndObject();

		//A multi part array
		json_writer.Key("MyArrayOfThings");
		json_writer.StartArray();
		for (i = 0; i< 3; i++)
		{
			json_writer.StartObject();
				json_writer.Key("Something");
				json_writer.Uint(1));

				json_writer.Key("SomethingElse");
				json_writer.Uint(2));
			json_writer.EndObject();
		}
		json_writer.EndArray();


	json_writer.EndObject();

	cout << json_string_buffer.GetString() << endl;
Element types
	json_writer.Key("name");
	json_writer.String("abcd");				

	json_writer.Key("name");
	json_writer.Int(some_variable);
				
	json_writer.Key("name");
	json_writer.Uint(some_variable);
	
	json_writer.Key("name");
	json_writer.Uint64(some_variable);

	json_writer.Key("name");
	json_writer.Double(3.1416);

	json_writer.Key("name");
	json_writer.Bool(true);

	json_writer.Key("name");
	json_writer.Null();

	json_writer.Key("name");
	json_writer.StartArray();
	for (unsigned i = 0; i < 4; i++)
		json_writer.Uint(i);
	json_writer.EndArray();

This is not a complete list

2 Level Array
	writer.Key("year");
	writer.Uint(year);

	writer.Key("available");
	writer.StartArray();
	for (day_of_month = 1; day_of_month <= 31; day_of_month++)
	{
		writer.StartArray();
		for (hour = 0; hour < 24; hour++)
		{
			writer.Bool(true);
		}
		writer.EndArray();
	}
	writer.EndArray();
http://miloyip.github.io/rapidjson/md_doc_sax.html#Writer

Strings

	writer.String("uid");
	writer.String((char*)MyCharArray);
	writer.String(MyString.c_str());
	writer.String((char*)ss1.str().c_str());