Skip to content

Data: JSON Modification Tools (Medium Priority) #63

Description

@jwesleye

Overview

Add targeted JSON modification tools to complement the existing token-saving read functions. Enable precise updates without loading/rewriting entire structures.

Motivation

We have 10 JSON inspection/reading tools (get_json_value_at_path, filter_json_array, etc.) but no targeted modification tools. Agents often need to update specific values, append to arrays, or merge objects without loading entire JSON structures.

Proposed Functions

High Priority - Targeted Updates

  • update_json_value_at_path - Update single value at path without full load (with skip_confirm)
  • delete_json_key_at_path - Remove specific key at path (with skip_confirm)
  • append_to_json_array - Add item to array at path (with skip_confirm)

Medium Priority - Structural Operations

  • merge_json_objects - Deep merge multiple JSON objects
  • sort_json_array - Sort array by key (in-place or return new)
  • flatten_json_object - Flatten nested object to single level with dot-notation keys
  • unflatten_json_object - Expand flat object with dot-notation keys to nested structure

Lower Priority - Bulk Operations

  • transform_json_values - Apply transformation function to values matching criteria
  • deduplicate_json_array - Remove duplicate items from array

Design Principles

  • Google ADK compliant (JSON-serializable types, no defaults)
  • @strands_tool decorator
  • Include skip_confirm parameter for destructive operations
  • Use dot notation for path access (consistent with get_json_value_at_path)
  • Return operation feedback strings
  • Memory-efficient where possible

Related

Module

data/json_tools.py

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions