by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Hasenradball
    @hasenradball
    The same Issue with the Dynamic Buffer.
    Is the Problem the char instead the String?
    Benoît Blanchon
    @bblanchon
    @hasenradball One of the major different between ArduinoJson 5 and 6 is that DynamicJsonBuffer automatically grows when full, whereas DynamicJsonDocument doesn't
    To fix your program, simply increase the capacity of the DynamicJsonDocument
    Use the ArduinoJson Assistant to compute the capacity
    Hasenradball
    @hasenradball
    @bblanchon
    Thank you for your help, i used the assistant to caclulate the doc size, but it does not match.
    Hasenradball
    @hasenradball
    Maybe is there some issue in the Assistant when caclulating the right buffer size? with the above example the assistant calculates jsonObjectSize(12) for Serialization but it seems to be to low.
    mars000
    @mars000
    image.png
    Hi - I'm using latest version for ArduinoJason 6.10.1 ... for some reason when I do a serailizeJsonPretty as per attached below it does not fully display the JSON to the serial...rather an incomplete version of the json. I don't know why -- any clues ?
    image.png
    this is the output int he serial:
    Hasenradball
    @hasenradball
    Please check your braces
    @mars000 your braces looks imcomplete.
    Hasenradball
    @hasenradball

    @bblanchon for this input the assistant calculates:

    {
      "version": "v23.1.1.2.3",
      "WLAN_USER_INPUT_Requested": true,
      "MAC": "DF:4F:22:11:0E:59",
      "Hostname": "123456789101112131415161718192021222324252627282930",
      "SSID": "12345678910111213141516171819202122232425262728293",
      "Password": "123456789101112131415161718192021222324252627282930",
      "Schwellwert": 1023,
      "Min": 255,
      "Max": 255,
      "ADC": 1023,
      "PT1": 1023,
      "Sprache": 1
    }

    JSON_OBJECT_SIZE(12) for Serialization but it is not enough.

    Hasenradball
    @hasenradball
    @bblanchon what does JSON_OBJECT_SIZE(12) mean in bytes?
    mars000
    @mars000
    @hasenradball the output is incomplete because that the error i'm reporting; as you can see from the output arduinojson successfully parses the file but fails to print it out on the screen fully for some reason
    Hasenradball
    @hasenradball
    Ok
    mars000
    @mars000
    @hasenradball I found the problem it seems. Everything renders ok when I reduce serial down to 115200 baud on my ESP32 but when I have it at 2,000,000 baud the serializeJsonPretty(doc, Serial); can't seem to keep up and the text is all garbled @bblanchon is this a known issue or something you have seen in the past [I'm using latest V6 library] ?
    Fernando
    @ferchinas

    Hello:
    I make a query out of topic.
    Anyone know any tool to programmatically minify .json files, which are in a folder on my pc, and paste them into arduino code variables?

    const char VarName[] = R "V0G0N (MINIFIED_JSON_FILE_HERE) V0G0N";

    I already tried to do it with Grunt but without success.
    Thank you

    Alexandr Zarubkin
    @me21
    Did you mean removing whitespaces and line breaks?
    Fernando
    @ferchinas
    @me21 Yes, that's what I mean, I have several json configuration files and I wanted to run some routine that takes spaces and line breaks to each one and inserts each one in each variable defined in a header file. To then compile and deploy the new firmware version.
    Alexandr Zarubkin
    @me21
    I think you can insert another file's contents with preprocessor #include directive
    As for transforming json, try jq: https://stedolan.github.io/jq/
    Fernando
    @ferchinas
    I'm writing the script in PowerShell and minifying with jq, @me21 Thank you very much !!!
    spencer1979
    @spencer1979
    Hi. Is it for nonarduino
    Nathan-ma
    @Nathan-ma
    Guys I need a quick help here!
    Im trying to pass a staticjsonobject as a function parameter with no success
    I’m just declaring a
    staticjsondocument<2048> doc both on my setup and on my function parameter
    It’s that how I was suppose to do?
    Alexandr Zarubkin
    @me21
    I'm not sure if it will avoid copying the data. Perhaps const reference instead of passing by value would work better
    Pratikm78
    @Pratikm78
    HI. How do i clear/destroy the entire json document?
    Hasenradball
    @hasenradball
    Hi benoit is there anything to consider when updating to the latest version v6?
    Benoît Blanchon
    @bblanchon
    @hasenradball , I wrote an article about it: https://arduinojson.org/2019/09/05/version-6-12-0/
    Hasenradball
    @hasenradball
    Thank you I will have a look :-)
    Christophe Persoz
    @christophepersoz

    Hi!
    I'm currently trying to send a boolean var over webSocket with an ESP32, and I can't get it working properly. All the other values are transmitted correctly except the boolean type. Do I need to convert the type into a char or an int equivalent value to make that worked?

    JsonObject _ack = jsonAck.to<JsonObject>() ;
    _ack["mode"].set(_mode); // mode : string
    _ack["ch"].set(_ch+1); // The channel number : uint8_t
    _ack["state"].set(Device[_ch].state); // _state : boolean 
    _ack["type"].set("ack") ; // type : string
    
    Serial.print("Send the ack for the channel ") ; Serial.println(_ch) ;
    Serial.print("mode: ") ; Serial.println(_mode) ;
    Serial.print("state: " ) ; Serial.print(_ack["state"] ) ; Serial.println( (uint8_t)Device[_ch].state ) ;
    Serial.print("type: ") ; Serial.println("ack") ;

    This above will return for Channel 0 for example, with _state = true;

    Send the ack for the channel 0
    mode: 0
    state: 01
    type: ack

    That shows that the print is correct, but the JsonObject _ack do not store the value correctly. Does anybody have already seen this?

    My current workaround is currently this on ESP32 side only

    _ack["state"].set( Device[_ch].state?"1":"0" );

    The client, which is a web browser still receive 0 instead of 1...

    Benoît Blanchon
    @bblanchon
    Hi @christophepersoz,
    ArduinoJson correctly serializes booleans, as you can see on this demo: https://wandbox.org/permlink/BY7M5V8FDc5pHecB
    However, I'm very surprise you could compile the following line:
    Serial.print(_ack["state"] ) ;
    Here, it generates the following compilation error:
    error: call of overloaded 'println()' is ambiguous
    To fix the error, I must use:
    Serial.print(_ack["state"] .as<bool>()) ;
    So, I think the problem is more in the way you print things.
    Benoît Blanchon
    @bblanchon
    If you need assistance with ArduinoJson, please open an issue on GitHub.
    I don't like Gitter, because it's disorganized and not searchable.
    I'm seriously considering deleting this room.
    Christophe Persoz
    @christophepersoz
    Hi @bblanchon! Thanks for the answer. I did the serial print as this in fact Serial.print((bool)_ack[state]); and it works that way. I gonna put an Issue on github; I’m totally agree with gitter,,it’s really hard a follow a thread here.
    Hasenradball
    @hasenradball
    Hello I have a Question regarding Arrays in Arduinojson:
    Can ArduinoJson handle multidimensional arrays?
      JsonObject timer1 = doc.createNestedObject("timer1");
      strcpy(timer1["on"],timer1[0][0]);
    Hasenradball
    @hasenradball

    @bblanchon I am truggling with ArduinoJson and a multiArray.
    I have a timer like this:
    char *timer[1][2];

    And the config looks like this:

     Loading configuration...
    {
      "wifi": {
        "hostname": "dummy",
        "ssid": "dummy",
        "password": "dummy"
      },
      "licht": {
        "schwelle": 12,
        "min": 0,
        "max": 200
      },
      "farbe": {
        "R": 255,
        "G": 255,
        "B": 255
      },
      "led": 60,
      "timer1": {
        "on": "12:00",
        "off": "0:00"
      }
    }

    And during read the configuration like:

    strlcpy(timer[0][0], doc["timer1"]["on"], 6);
    strlcpy(timer[0][1], doc["timer1"]["off"], 6);

    I get an Stack issue:

    
    Decoding stack results
    0x4010038d: __wrap_spi_flash_read(uint32_t, uint32_t*, size_t) at C:\Users\Frank\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\cores\esp8266\core_esp8266_phy.cpp line 309
    0x4020dd4d: EspClass::flashRead(unsigned int, unsigned int*, unsigned int) at C:\Users\Frank\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\cores\esp8266\Esp.cpp line 648
    0x40212c48: flash_hal_read(unsigned int, unsigned int, unsigned char*) at C:\Users\Frank\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\cores\esp8266\flash_hal.cpp line 67
    0x402142e0: spiffs_obj_lu_scan_v(spiffs*, spiffs_obj_id, spiffs_block_ix, int, void const*, void*) at C:\Users\Frank\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\cores\esp8266\spiffs\spiffs_nucleus.cpp line 332
    0x4020e170: HardwareSerial::write(unsigned char const*, unsigned int) at C:\Users\Frank\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\cores\esp8266/HardwareSerial.h line 165
    0x40208c00: WiFiServer::close() at C:\Users\Frank\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\ESP8266WiFi\src\WiFiServer.cpp line 129
    0x40201eb4: esp8266webserver::ESP8266WebServerTemplate ::begin() at C:\Users\Frank\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\ESP8266WebServer\src/ESP8266WebServer-impl.h line 104
    0x4020f811: String::invalidate() at C:\Users\Frank\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\cores\esp8266\WString.cpp line 140
    0x40219350: std::_Function_handler ::_M_invoke(std::_Any_data const&) at c:\users\frank\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506\xtensa-lx106-elf\include\c++\4.8.2/functional line 2069
    0x40219350: std::_Function_handler ::_M_invoke(std::_Any_data const&) at c:\users\frank\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506\xtensa-lx106-elf\include\c++\4.8.2/functional line 2069
    0x40219364: std::_Function_base::_Base_manager ::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation) at c:\users\frank\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506\xtensa-lx106-elf\include\c++\4.8.2/functional line 1934
    0x40205d64: setup() at X:\ESP8266-01\ESP8266-01_WS2812b_Stribe_Esszimmer_v1_2/ESP8266-01_WS2812b_Stribe_Esszimmer_v1_2.ino line 99
    0x40206d24: handleNotFound() at C:\Users\Frank\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\ESP8266WebServer\src/ESP8266WebServer.h line 131
    0x40219364: std::_Function_base::_Base_manager ::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation) at c:\users\frank\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506\xtensa-lx106-elf\include\c++\4.8.2/functional line 1934
    0x40219350: std::_Function_handler ::_M_invoke(std::_Any_data const&) at c:\users\frank\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506\xtensa-lx106-elf\include\c++\4.8.2/functional line 2069
    0x40210b00: loop_wrapper() at C:\Users\Frank\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\cores\esp8266\core_esp8266_main.cpp line 177
    Compiling works fine.