{"action":"closed","issue":{"url":"https://api.github.com/repos/bblanchon/ArduinoJson/issues/799","repository_url":"https://api.github.com/repos/bblanchon/ArduinoJson","labels_url":"https://api.github.com/repos/bblanchon/ArduinoJson/issues/799/labels{/name}","comments_url":"https://api.github.com/repos/bblanchon/ArduinoJson/issues/799/comments","events_url":"https://api.github.com/repos/bblanchon/ArduinoJson/issues/799/events","html_url":"https://github.com/bblanchon/ArduinoJson/issues/799","id":351032903,"node_id":"MDU6SXNzdWUzNTEwMzI5MDM=","number":799,"title":"Error parsing char json string into an object, when the length of the string doesn't match the size of the array?","user":{"login":"agathauy","id":17349699,"node_id":"MDQ6VXNlcjE3MzQ5Njk5","avatar_url":"https://avatars3.githubusercontent.com/u/17349699?v=4","gravatar_id":"","url":"https://api.github.com/users/agathauy","html_url":"https://github.com/agathauy","followers_url":"https://api.github.com/users/agathauy/followers","following_url":"https://api.github.com/users/agathauy/following{/other_user}","gists_url":"https://api.github.com/users/agathauy/gists{/gist_id}","starred_url":"https://api.github.com/users/agathauy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agathauy/subscriptions","organizations_url":"https://api.github.com/users/agathauy/orgs","repos_url":"https://api.github.com/users/agathauy/repos","events_url":"https://api.github.com/users/agathauy/events{/privacy}","received_events_url":"https://api.github.com/users/agathauy/received_events","type":"User","site_admin":false},"labels":[{"id":74339347,"node_id":"MDU6TGFiZWw3NDMzOTM0Nw==","url":"https://api.github.com/repos/bblanchon/ArduinoJson/labels/question","name":"question","color":"cc317c","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-08-16T02:29:23Z","updated_at":"2018-08-19T13:00:16Z","closed_at":"2018-08-19T13:00:16Z","author_association":"NONE","body":"Hello, I've read the FAQ about this but am still having problems with parsing a JSON string. I'm using an Arduino Uno for testing.\r\n\r\nHere's a snippet of the situation:\r\n\r\n```\r\n  char buffer[240];\r\n  // [Insert other processing stuff to get data into buffer...]\r\n\r\n  Serial.print(F(\"buffer: \")); Serial.println(buffer); // {\\\"m\\\":120000,\\\"s\\\":1,\\\"us\\\":0,\\\"t\\\":1534385686}\r\n  Serial.print(F(\"strlen(buffer): \")); Serial.println(strlen(buffer)); // 48 so this is correct\r\n  Serial.print(F(\"sizeof(buffer): \")); Serial.println(sizeof(buffer)); // 240\r\n\r\n\r\n  Serial.print(F(\"fM()= \"));\r\n  Serial.println(freeMemory()); // 60 -- free memory shows just these amount of bytes remaining\r\n\r\n  StaticJsonBuffer<200> jsonBuffer2; // I increased it a bit compared to ArduinoJSON assistant    since that worked sometimes for memory issues\r\n  JsonObject& root2 = jsonBuffer2.parseObject(buffer); //root2 since I parse a HTTP response to   get the above buffer from BASE64 & AES decryption, so there's just a \"root\"\r\n   if (!root2.success()) {\r\n          Serial.println(F(\"CP\")); // Would reach this so there's an error\r\n\t   return -2; // Device error\r\n   }\r\n```\r\n\r\nHowever, if I use the same code and parse this instead of \"buffer\" it works.\r\n`\r\n  const char* encoded2 = \"{\\\"m\\\":120000,\\\"s\\\":1,\\\"us\\\":0,\\\"t\\\":1534356559}\";\r\n`\r\n\r\nI know that buffer[240] is getting overwritten, but I'm not sure what's causing this wrong behavior, or if it's a bug since I searched the docs for the issue. And I'm not getting any luck looking at the code."}}
{"actor":{"display_login":"agathauy"}}