Working with Responses

Every time you call a function of a module you will earn a generic response in JSON format. The structure is explained in the wiki.

To handle the response it is recommended to parse the JSON string that is returned. The most basic thing you might want to do is to check if the operation was successful. Therefore you need to check the isSuccess field. More sophisticated scenarios would be to check the content of the response that might contain gathered messages from a Telegram bot.

I would recommend you to use a JSON parser. A full sample implementation can be found in my Git repo.

There it looks something like this:
1. Include the 3rd party library to parse JSON (borrowed from here

#include <MMM\JAson.mqh>

2. Create a parser object

CJAVal jsonLib(NULL,jtUNDEF);

3. Deserialize a response and check the success status:

response = "{\"isSuccess\":true,\"content\":{...}}";
isSerializable = jsonLib.Deserialize(response);
isSuccess = jsonLib["isSuccess"].ToBool();