Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A ArduinoJson
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 24
    • Issues 24
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Benoît Blanchon
  • ArduinoJson
  • Issues
  • #808
Closed
Open
Issue created Sep 10, 2018 by Administrator@rootContributor

get<String> returns "-0" for 0

Created by: RAlexeev

get<String> returns different outputs of 0 for v6.3.0-beta and v6.2.3-beta. In case of v6.3.0-beta it returns "-0" (minus occurs before 0), but in case of v6.2.3-beta it returns "0".

Example:

char json[] = "{\"x\":0}";
StaticJsonDocument<256> doc;
deserializeJson(doc, json);
JsonObject object = doc.as<JsonObject>();
obj["x_str"] = object.get<String>("x");
obj["x_uint"] = object.get<unsigned int>("x");

Output in case of v6.3.0-beta:

x_str = "-0"
x_uint = 0

Output in case of v6.2.3-beta:

x_str = "0"
x_uint = 0

I use Platformio IDE 1.1.1 with the following settings:

platform = https://github.com/platformio/platform-espressif8266.git#v1.8.0
board = esp_wroom_02
framework = arduino
Assignee
Assign to
Time tracking