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
  • #55
Closed
Open
Issue created Mar 06, 2015 by Administrator@rootContributor

Assign String to key doesn't work

Created by: dcsoftware

Hi, I run into this issue and I don't know if I am doing something wrong or there is a problem in the library. When I assign a string value to a key in an object, what it is assigned is true value. I have a string received from Serial witch I cut into several substring and them create a json with this data. Here is a sample of my code:

char buff[64];

Serial.readBytesUntil(10, buff, sizeof(buff));

String s = buff;

StaticJsonBuffer<300> jsonBuffer;

JsonObject& root = jsonBuffer.createObject();

root["key"] = s.substring(10, 20); root["key1"] = s.substring(21, 28);

root.printTo(Serial);

The output is: {"key":true,"key1":true}

instead of having my substring it store a "true" value. Same thing happens if I do this:

String a = s.substring(10,20);

root["key"] = a;

Waiting for an answer a in the mean time, Thank very much for your awesome work!!!

Assignee
Assign to
Time tracking