trying to get data from json response (problem with storing the json fields in external variables)

Jul 15, 2015 at 12:52 PM
Edited Jul 16, 2015 at 9:28 AM
I have made an http request and I get the response as json. I think I get the json values.(I have tested the first one).I want to store all the json fields of the response in two externals object(externals to the lambda function) and I the pointers on these two objects are members from my object which method contains the lambda function I have tryed as capture list :[this] but the program crash as soon I call the pointer later (this->object1->set(....)), I have tryed to with two local (two local variables externals to the lambda) pointers with are initialised with the two pointers and with [pointer1,pointer2] and it crashes too when I call pointer1->set(...),and I have tryed with two external (to the lambda function) local variables object1 and object2 and with [&object1,&object2] as capture list and it crashes too when I call object1.set(...) in the lambda function.
The method that contains the http request and response is a method from a COM MTA component......I receive a http reponse 200.the only problem is the capture list and how to store the fields of my response because it doesn't run....
I use visual studio 2013, winsdk 7.1A (under windows 7 sp1), ATL COM and the last version of casablanca.
I have this error in the case of this->object1->set(...) :Unhandled exception at 0x66D72656 (xxxxx.dll) in OUTLOOK.EXE: 0xC0000005: Access violation writing location 0x74BCFAB4. and it crashes when I call this->object1->set(...), i.e. when I save the value of the json field in my external (to the lamda function) object "*object1 ".(the COM MTA object is in a plugin (dll) for outlook)
In the case where I use two externals objects and wit hthis capture list [&object1,&object2], I have this error :"Unhandled exception at 0x04E352E9 (MSO.DLL) in OUTLOOK.EXE: 0xC0000602: Une exception FailFast s’est produite. Les gestionnaires d’exceptions ne seront pas appelés et le processus va se terminer immédiatement."
and it seems to crash here :
(at the end of my http request and response).
the beginning of my request is :

client.request(requete).then([&loffre,&luser](http_response response)

    if (web::http::status_codes::OK == response.status_code())

        std::shared_ptr<web::json::value> jv = std::make_shared<web::json::value>(response.extract_json().get());


Jul 17, 2015 at 9:29 AM
it seems to be solved, it is ok with two local external objects but I must check that some json fields are not null before assigning them with is_null()