25 lines
391 B
C++
25 lines
391 B
C++
#include "openjson.h"
|
|
#include <iostream>
|
|
#include <assert.h>
|
|
|
|
int main()
|
|
{
|
|
std::string buff1;
|
|
|
|
OpenJson json;
|
|
auto& nodeRoot = json["users"];
|
|
size_t i = 0;
|
|
// ±éÀú½á¹û¼¯
|
|
while (i < 3)
|
|
{
|
|
auto& node = nodeRoot[i];
|
|
node["id"] = "userid";
|
|
node["user"] = "user";
|
|
node["passwd"] = "passwordpassword";
|
|
node["salt"] = "saltsaltsalt";
|
|
i++;
|
|
}
|
|
buff1 = json.encode();
|
|
|
|
return 0;
|
|
} |