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
  • #693
Closed
Open
Issue created Mar 08, 2018 by Administrator@rootContributor

JsonBuffer::parse() doesn't respect nesting limit properly

Created by: Adam5Wu

Thanks for the great library! It saves me so much time and headache. :)

However, I am encountering some difficulties using the parse method for a slightly different purpose. I am trying to write a utility which accepts user input and update json accordingly.

For example:

  • Original json: { "Test": "abc" }
  • User input: Test="def"
  • My logic intends to do the following:
    1. Parse input string and obtain the key Test and value "def"
    2. Use ArduinoJson to parse the value "def" into a JsonVariant, make sure user indeed provide a simple string, not a json object or array
    3. Assign the parsed JsonVariant to the original json with the given key
  • Expected new json: { "Test": "def" }

However, I am stuck on step 2, because when I call jsonBuffer.parse("\"def\"", 0) the result always fail. Reading the document, I suspect the parse method can only accept serialized json object or array, not a simple value, such as boolean, integer, or string. Am i missing anything?

Note that since the utiltiy is general purpose, I cannot know ahead of time which field is which type, I think it is a perfect case to utilize the parser and JsonVariant to achieve this goal and keep the code simple and elegant.

Assignee
Assign to
Time tracking