openwrt / openwrt/libubox

libubox: add methods to delete elements from array and objects

Open
#5 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
32
Forks
35
PR merge metrics
No merged PRs in 30d

Description

Sometimes provisioning information will be provided in a JSON file at image build time that might turn out to be greater than what's detected at run-time. In those cases, it might be handy to be able to load a file, perform run-time validations that elements are or aren't present, and if the later delete them from objects and arrays before either iterating over that configuration, or saving it back out for later use.

To this end, please add methods like json_delete_nth which takes an integer (ordinal) n and deletes the n'th member of an array container, or else json_delete_key which deletes the member whose key matches key from an object container.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing libubox JSON array and object APIs and any tests covering them. Add the requested json_delete_nth and json_delete_key entry points, then verify that array members or object members with matching keys can be removed before iteration or saving the JSON.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.