Skip to content

Feature Request: Filter Key by Size? #1636

Open
@dmadison

Description

@dmadison

Hello again!

The filtering feature is incredibly useful, although at the moment it's currently limited to including / excluding keys. Would it be possible to extend the filtering feature to limit values to a given size?

My suggested API would be the same as the current filtering API, except that instead of setting a key to 'true' to save it you would set the key to the number of characters to parse. Using JsonFilterExample.ino as a demo:

  StaticJsonDocument<200> filter;
  filter["list"][0]["dt"] = 10;  // max of 10 characters long (excluding terminator)
  filter["list"][0]["main"]["temp"] = 4;  // ibid, 4 characters long

Key values that are larger than the specified amount would be truncated.

The benefit would be that it would be easier to control the size of the JSON document, as unexpectedly large fields would no longer take up additional memory.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions