i wanted to create a JSON using Aws-sdk for C++. this is what i am doing so far.
void convertStructToAwsJSON()
{
Aws::Utils::Json::JsonValue jsonValue = Aws::Utils::Json::JsonValue();
jsonValue.WithDouble("percentage", 93.6);
jsonValue.WithInteger("age", 25);
float grades[3] = {87, 95, 65};
jsonValue.WithArray("grades", grades);
}
but it seems like it throws an error, saying that it is not of the argument type. I checked the documentation and the only thing I can do is add an array of type String.
const Aws::Utils::Array<Aws::String> grades;
grades[0] = "87";
grades[1] = "95";
grades[2] = "65";
jsonValue.WithArray("grades", grades);
Now it works. How to store it in double or integer instead of string?
Alright got a response from the AWS SDK Team. It can be done like this:
Source: https://github.com/aws/aws-sdk-cpp/issues/1526