// create a new MojObject MojObject myObj; // add a string key-value pair "name" : "Alice" to myObj myObj.putString("name", "Alice");
// create a new MojObject MojObject myObj; // a variable containing our name std::string myName = "Bob"; // add a string key-value pair "name" : the value of myName to myObj myObj.putString("name", myName);In this example, we again create a new empty MojObject, and this time use putString() to add a "name" key-value pair where the value is a variable containing a string. MojObject is part of the Mojolicious framework's C++ library.