Help needed with if and json object

So I have a server on my computer with a basic json file.
The file has an object which has a value, and when i put the value as a number, the if comparison worked flawlessly, but once i want to replace the number with the word "success", it just wouldnt work

written up before void setup i have

char statusresult;

then this is part of the json request

const size_t bufferSize = JSON_OBJECT_SIZE(1) + 30;
        DynamicJsonBuffer jsonBuffer(bufferSize);
        const char* json = "{\"status\":error}";
        JsonObject& root = jsonBuffer.parseObject(status);
       statusresult = root["status"];

then later i have an if statment

 if (statusresult == "success")

can anyone help me?
Thank you

  1. What does root["status"] return?

  2. statusresult is a character, you cannot compare itwith a whole "success" string.

{
"validation": "success"
}

but when i write Serial.print(statusresult);
it gives me a random number, sometimes 5, sometimes 9, sometimes 6, etc...

when i set the validation in the json file to a number, the if comparison works and continues with the code, its just when i changed it to a word it stopped working.

Can you guide me on how to fix this
Thank You

Can you guide me on how to fix this

If you have a size one shoe, can you put your size twelve foot in it?

No, of course not. So, what size object, and what type, do you need to store "success" in?

When you have figured that out, changing the code will be trivial.

You might also want to look at what type the [] operator ACTUALLY returns, when it operates on a JsonObject, instead of guessing.