Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Arduino v3.1.2 String crashes on serializeJson #2158

Copy link
Copy link
Closed
@Tobi177

Description

@Tobi177
Issue body actions

Describe the bug
On the latest Arduino release v3.1.2 the function serializeJson does not work anymore and the app is crashing instantly. Within the Arduino release I see that some changes to the String objects were done: espressif/arduino-esp32#10938 Maybe, around this issue is the reason for the crashes, but that is just an assumption. Switching back to previous releases are working fine again. I rollback to Arduino v3.1.1 and the app is working fine again.

Environment
esp-idf v5.3 and Arduino v3.1.2 as a component
ArduinoJson v7.3.0
esp32, esp32c2

Reproduction

String getAvailableNetworks() {

  JsonDocument json_doc;
  JsonArray networks = json_doc.to<JsonArray>();

  int n = WiFi.scanNetworks(false, false);
  if (n) {
    for (int i = 0; i < n; ++i) {
      JsonObject networkObj = networks.add<JsonObject>();
      networkObj["ssid"] = WiFi.SSID(i);
      networkObj["rssi"] = WiFi.RSSI(i);
      networkObj["authmode"] = (WiFi.encryptionType(i) == WIFI_AUTH_OPEN) ? 0 : 1;
    }
  }

  String json_available_networks;
  serializeJson(json_doc, json_available_networks);  // CRASHES HERE

  return json_available_networks;

}

Only the String handling is affected! Once I use char arrays/pointers the serializeJson work fine on Arduino v3.1.2 as well. Only if strings are serialized the problem occurs. Please report back if any further information are needed. Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugv7ArduinoJson 7ArduinoJson 7

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.