bblanchon / ArduinoJson

📟 JSON library for Arduino and embedded C++. Simple and efficient.
https://arduinojson.org
MIT License
6.69k stars 1.12k forks source link

Input string gets truncated #1365

Closed Findus76 closed 4 years ago

Findus76 commented 4 years ago

Input string to deserializeJson gets truncated. Before function calls, the string is 643 characters. And after only 4 characters. Did not think the function would affect the input string.

Console output Checking function file Result string: {"Type":"SystemFunction","Function list":{"Relay ch1":{"R/W":"W","Position":"EnergyMeter","Head Type":"Relay","Sub Type":"Main Voltage","State":"ON/OFF","Description":"Solidstate max 2A"},"Relay ch2":{"R/W":"W","Position":"EnergyMeter","Head Type":"Relay","Sub Type":"Main Voltage","State":"ON/OFF","Description":"Solidstate max 2A"},"Relay ch3":{"R/W":"W","Position":"EnergyMeter","Head Type":"Relay","Sub Type":"Main Voltage","State":"ON/OFF","Description":"Solidstate max 2A"},"Relay ch4":{"R/W":"W","Position":"EnergyMeter","Head Type":"Relay","Sub Type":"Main Voltage","State":"ON/OFF","Description":"Solidstate max 2A"}}} Result string: Type

Before running deserializeJson, i have long string ({"Type":"SystemFunction","Fun......) But after only: Type

Code bool CheckJSONfunctionFile(char* functionList, uint16_t Listleght) { bool status = false; Serial.print("Checking function file\r\n"); Serial.print("Result string: "); Serial.println(functionList); DynamicJsonDocument FunclistDoc(Listleght + 100); DeserializationError err = deserializeJson(FunclistDoc, functionList, Listleght); Serial.print("Result string: "); Serial.println(functionList); if (!err)

bblanchon commented 4 years ago

Hi,

Please read:

Best regards, Benoit

Findus76 commented 4 years ago

Sorry, had missed that info. It is very well documented with good examples.

Tanks!