I want a c++ program that converts the following structure to a JSON object and then stringifies that object.
The end result is an std::string that contains all the data under a JSON string format.
Requirements:
The program must compile under Linux and Windows
I would like a single header JSON library to be used...no DLL and no .libs to manage
The program must std::cout the exact same string as the string given at STEP#3 below.
Files to return:
All the source code files that makes the compilation of the program possible.
--------STEP#1:STARTING DATA---------
struct {
bool out_inputs_activated[8] = { false,false,false,false,false,false,false,false };
bool out_outputs_activated[8] = { true,true,true,true,true,true,true,true };
bool in_outputForces_activated[8] = { true,false,true,false,true,false,true,false };
int out_inspectionResult = 75;
int out_movingTrendResults[10] = { 1,5,7,4,55,3,44,65,11,22 };
std::pair<int, int> out_barChartData[3] = { std::make_pair(10,14), std::make_pair(20,34), std::make_pair(30,44) };
};
--------STEP#2:DATA TRANSFORMED IN A JSON STRUCTURE---------
JSON structure :
{
"io_states": {
"digital_inputs": [
false,
false,
false,
false,
false,
false,
false,
false
],
"digital_outputs": [
true,
true,
true,
true,
true,
true,
true,
true
]
},
"system_state": [
"running"
],
"inspection": {
"result_value": 75,
"result_reject_decision": false
},
"statistics": {
"trend_values": [
12,
54,
78,
45,
23,
56,
75,
13,
31
],
"bar_chart": [
[
0,
23
],
[
10,
76
],
[
90,
8
]
]
}
}
--------STEP#3:JSON OBJECT TRANSFORMED TO A STRING---------
Stringified JSON:
{"io_states":{"digital_inputs":[false,false,false,false,false,false,false,false],"digital_outputs":[true,true,true,true,true,true,true,true]},"system_state":["running"],"inspection":{"result_value":75,"result_reject_decision":false},"statistics":{"trend_values":[12,54,78,45,23,56,75,13,31],"bar_chart":[[0,23],[10,76],[90,8]]}}