{"action":"created","issue":{"url":"https://api.github.com/repos/menan/SparkJson/issues/1","labels_url":"https://api.github.com/repos/menan/SparkJson/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/menan/SparkJson/issues/1/comments","events_url":"https://api.github.com/repos/menan/SparkJson/issues/1/events","html_url":"https://github.com/menan/SparkJson/issues/1","id":58528879,"number":1,"title":"Parsing Fails on request.body","user":{"login":"mishawagon","id":151957,"avatar_url":"https://avatars.githubusercontent.com/u/151957?v=3","gravatar_id":"","url":"https://api.github.com/users/mishawagon","html_url":"https://github.com/mishawagon","followers_url":"https://api.github.com/users/mishawagon/followers","following_url":"https://api.github.com/users/mishawagon/following{/other_user}","gists_url":"https://api.github.com/users/mishawagon/gists{/gist_id}","starred_url":"https://api.github.com/users/mishawagon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mishawagon/subscriptions","organizations_url":"https://api.github.com/users/mishawagon/orgs","repos_url":"https://api.github.com/users/mishawagon/repos","events_url":"https://api.github.com/users/mishawagon/events{/privacy}","received_events_url":"https://api.github.com/users/mishawagon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-22T23:49:28Z","updated_at":"2015-02-23T22:55:59Z","closed_at":null,"body":"Thank you very much for this library. When I run your example, it works. But if instead of using a json string in the code, I load it using the HTTP client library, the parsing breaks. The http client is pulling down a page that has nothing on it but the same exact text as your example:\r\n\r\n{\\\"sensor\\\":\\\"gps\\\",\\\"time\\\":1351824120,\\\"data\\\":[48.756080,2.302038]}\r\n\r\nAny ideas why parseObject() would fail if the data is coming in as a request.body that has been copied over to a string?\r\n\r\n\r\n\r\nvoid loop() {\r\n    if (nextTime > millis()) {\r\n        return;\r\n    }\r\n    \r\n    request.hostname = \"misharabinovich.com\";\r\n    request.path = \"/projects/sprk/index.html\";\r\n    \r\n    request.port = 80;\r\n  // Get request\r\n    http.get(request, response, headers);\r\n   \r\n    char charBuf[300];\r\n    response.body.toCharArray(charBuf, 300);\r\n    \r\n    char json[] = {};\r\n    strcpy(json, charBuf);\r\n    StaticJsonBuffer<300> jsonBuffer;\r\n    \r\n    JsonObject& root = jsonBuffer.parseObject(json);\r\n    \r\n    nextTime = millis() + 10000;\r\n    Serial.print(\"Response Begin\\t\");\r\n    Serial.println(charBuf);\r\n    if (!root.success()) {\r\n        \r\n        Serial.println(\"parseObject() failed\");\r\n        return;\r\n    }\r\n\r\n    Serial.print(\"Response Begin\\t\");\r\n    long t_time = root[\"time\"];\r\n    Serial.print(t_time);\r\n}\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/menan/SparkJson/issues/comments/75656122","html_url":"https://github.com/menan/SparkJson/issues/1#issuecomment-75656122","issue_url":"https://api.github.com/repos/menan/SparkJson/issues/1","id":75656122,"user":{"login":"mishawagon","id":151957,"avatar_url":"https://avatars.githubusercontent.com/u/151957?v=3","gravatar_id":"","url":"https://api.github.com/users/mishawagon","html_url":"https://github.com/mishawagon","followers_url":"https://api.github.com/users/mishawagon/followers","following_url":"https://api.github.com/users/mishawagon/following{/other_user}","gists_url":"https://api.github.com/users/mishawagon/gists{/gist_id}","starred_url":"https://api.github.com/users/mishawagon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mishawagon/subscriptions","organizations_url":"https://api.github.com/users/mishawagon/orgs","repos_url":"https://api.github.com/users/mishawagon/repos","events_url":"https://api.github.com/users/mishawagon/events{/privacy}","received_events_url":"https://api.github.com/users/mishawagon/received_events","type":"User","site_admin":false},"created_at":"2015-02-23T22:55:59Z","updated_at":"2015-02-23T22:55:59Z","body":"Hello thank you for your feedback. I tried 2000 and also the allocation method detailed in the linked article. The parse fails, however I am going through an extra step that also fails. I copy the body.response to a string first, because otherwise the char json[] = response.body fails with mismatched datatype error. The weird thing is that when I Serial.print the string that was created the first four characters are truncated:\r\n\r\nensor\\\":\\\"gps\\\",\\\"time\\\":1351824120,\\\"data\\\":[48.756080,2.302038]}\r\n\r\ninstead of:\r\n\r\n{\\\"sensor\\\":\\\"gps\\\",\\\"time\\\":1351824120,\\\"data\\\":[48.756080,2.302038]}\r\n\r\nI tried to quickly just add 4 spaces in the response file to \"get rid\" of this problem, but the parse still fails. Is your working code online anywhere by chance? I would to use an existing api service that talks json http://sunrise-sunset.org/api\r\n\r\nI am making a grow light that sinks to sun activity in a specific part of the world. Anyway, any info would be greatly appreciated!  Cheers"}}