{"action":"created","issue":{"url":"https://api.github.com/repos/aws/aws-iot-device-sdk-embedded-C/issues/15","repository_url":"https://api.github.com/repos/aws/aws-iot-device-sdk-embedded-C","labels_url":"https://api.github.com/repos/aws/aws-iot-device-sdk-embedded-C/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/aws/aws-iot-device-sdk-embedded-C/issues/15/comments","events_url":"https://api.github.com/repos/aws/aws-iot-device-sdk-embedded-C/issues/15/events","html_url":"https://github.com/aws/aws-iot-device-sdk-embedded-C/issues/15","id":149057022,"number":15,"title":"How to receive complete json object in delta callback function","user":{"login":"nikitanerkar","id":1756721,"avatar_url":"https://avatars.githubusercontent.com/u/1756721?v=3","gravatar_id":"","url":"https://api.github.com/users/nikitanerkar","html_url":"https://github.com/nikitanerkar","followers_url":"https://api.github.com/users/nikitanerkar/followers","following_url":"https://api.github.com/users/nikitanerkar/following{/other_user}","gists_url":"https://api.github.com/users/nikitanerkar/gists{/gist_id}","starred_url":"https://api.github.com/users/nikitanerkar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikitanerkar/subscriptions","organizations_url":"https://api.github.com/users/nikitanerkar/orgs","repos_url":"https://api.github.com/users/nikitanerkar/repos","events_url":"https://api.github.com/users/nikitanerkar/events{/privacy}","received_events_url":"https://api.github.com/users/nikitanerkar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-04-18T06:39:38Z","updated_at":"2016-04-20T21:40:48Z","closed_at":null,"body":"The callback function registered for aws_iot_shadow_register_delta obj, returns partial json string. In my use-case, the application is publishing and subscribed to the same thing shadow. The device has both local and remote control, due to which in some of the use-cases, delta callback function gets invoked with stale information. For example, device publishes it's state as _false_ initially, and desired state is set to _true_ using thing shadow, then the callback function gets invoked and device state is updated and published as _true_. After that, if device state is set to _false_ using local control button, and this state is published, then the callback function gets invoked again, as there is difference in desired state and reported state. This time changing device state is not desirable as the request is already processed and this requires metadata/time-stamp to skip this stale information. But as the callback function returns partial json string, parsing of the json object is becoming difficult. Is there any other way to access complete string received from the thing shadow?"},"comment":{"url":"https://api.github.com/repos/aws/aws-iot-device-sdk-embedded-C/issues/comments/212618535","html_url":"https://github.com/aws/aws-iot-device-sdk-embedded-C/issues/15#issuecomment-212618535","issue_url":"https://api.github.com/repos/aws/aws-iot-device-sdk-embedded-C/issues/15","id":212618535,"user":{"login":"gkwicker","id":14828980,"avatar_url":"https://avatars.githubusercontent.com/u/14828980?v=3","gravatar_id":"","url":"https://api.github.com/users/gkwicker","html_url":"https://github.com/gkwicker","followers_url":"https://api.github.com/users/gkwicker/followers","following_url":"https://api.github.com/users/gkwicker/following{/other_user}","gists_url":"https://api.github.com/users/gkwicker/gists{/gist_id}","starred_url":"https://api.github.com/users/gkwicker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gkwicker/subscriptions","organizations_url":"https://api.github.com/users/gkwicker/orgs","repos_url":"https://api.github.com/users/gkwicker/repos","events_url":"https://api.github.com/users/gkwicker/events{/privacy}","received_events_url":"https://api.github.com/users/gkwicker/received_events","type":"User","site_admin":false},"created_at":"2016-04-20T21:40:48Z","updated_at":"2016-04-20T21:40:48Z","body":"Hi @nikitanerkar,\r\n\r\nIf you set the `jsonStruct_t` `pKey` field to `\"state\"` in the call to `aws_iot_shadow_register_delta()`, you will receive a pointer to the state data in the delta callback.  Then you'd be able to compare the values and see if they differ from your local state.  You can read about this approach in [the API documentation](http://aws-iot-device-sdk-embedded-c-docs.s3-website-us-east-1.amazonaws.com/aws__iot__shadow__interface_8h.html#a2018994362d1ecc99af2151227d5bb41) and see an example of this in the code for the [shadow_console_echo.c example application.](https://github.com/aws/aws-iot-device-sdk-embedded-C/blob/master/sample_apps/shadow_sample_console_echo/shadow_console_echo.c#L148).  Let us know if that helps, and thanks for using AWS IoT."}}