I'm qui te new on Arduino and it's like i'm getting trouble with some cases :
I'm using JsonParser Library. All work well, so I've started to ckean up my code and refactor my code.
I've tried to create a function that return JsonObject but it doesn't accept it :
JsonObject getJsonObject() {
}
Just this chunk of code generate this error : JsonObject does not name a type. So bad, when I delete this function, my other code (which uses JsonObject) works... what the point ?
to workaround this problem, I've created another function but I still have difficulties.
When getting JsonObject result, we can access its values by writing this :
int myresult = myjson["key1"][0]
I've tried to create a function that get the key name in parameter but I can't manage to make it work
I tried this
function GetParsedValue(char* Key) {
jsonObject result = code to get my json;
return result[Key];
}
but it doesn't work. I've tried to get my answer on the internet but could not find anything.
If you have a clue...
Thanks
Steeve
I’m using this parser : https://github.com/bblanchon/ArduinoJson/tree/master/JsonParser
You will see that you can get a JsonObject from this library.
My main idea is this : Create a function that will get http response, parse it into a JsonObject and then return this object.
When verifying compilation, it says : JsonObject does not name a type.
Sorry for my lack in C++, I come from .Net world and things are simplier about this kind of things ^^
Thanks for your help
I added the line marked “function prototype”. Normally in C++ you need to declare functions before you use them, but the Arduino IDE tries to do that for you, not always successfully.