Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in vs can't find linkageId #466

Closed
lumigit opened this issue Feb 21, 2017 · 1 comment
Closed

in vs can't find linkageId #466

lumigit opened this issue Feb 21, 2017 · 1 comment

Comments

@lumigit
Copy link

lumigit commented Feb 21, 2017

string payload = "{\"linkageId\":\"L.4028044806278569\",\"conditions\":{\"content\":[{\"op\":0,\"beginTimeSpan\":\"\",\"isHeartbeatTrigger\":0,\"serialNum\":0,\"delayTime\":0,\"rid\":\"13.1.85\",\"type\":16,\"value\":\"1\",\"did\":\"lumi.158d00010fd68d\",\"endTimeSpan\":\"\"}],\"relation\":\"0\"},\"actions\":{\"content\":[{\"duration\":1800,\"serialNum\":0,\"autoReset\":0,\"increase_value\":0,\"delayTime\":0,\"priority\":5,\"rid\":\"4.1.85\",\"type\":2,\"value\":\"2\",\"did\":\"lumi.158d0001254584\",\"onTriggerResetDelay\":0}]}}";

json linkage_pack = payload;
string linkageID = linkage_pack["linkageId"];

//================
json linkage_pack = json::parse(payload.c_str());
string linkageID = linkage_pack["linkageId"];

it's ok

@nlohmann
Copy link
Owner

You can also just json::parse(payload) - there is no need to call c_str().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants