Skip to content

deserialize a non json string gives inconsistent error result #1781

@AcuarioCat

Description

@AcuarioCat

Description
Deserializing a non json string sometimes does not return a non zero error code.

Troubleshooter's report

  1. The issue happens at run time
  2. The issue concerns deserialization
  3. The program crashes
  4. Program crashes after calling deserializeJson()

Environment

  • Microcontroller: ESP32
  • Core/Framework: ESP32 2.0.3
  • IDE: Visual Micro

Reproduction code

	DynamicJsonDocument root(800);
	String s = "force an esp exception";
	DeserializationError error = deserializeJson(root, s);
	Serial.printf("Error:%d\n", error);

	s = "definitely not a json";
	error = deserializeJson(root, s);
	Serial.printf("Error:%d\n", error);

	s = "{\"value\":1,";
	error = deserializeJson(root, s);
	Serial.printf("Error:%d\n", error);

Remarks
Result from above:
Error:0
Error:3
Error:2

Error 0 should not be 0, should return 3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugv6ArduinoJson 6

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions