json_filter
Filter JSON files by extracting specific fields using a shape object. Define fields to include with nested structures for deep extraction, ensuring precise data retrieval.
Instructions
Filter JSON data using a shape object to extract only the fields you want. Provide filePath and shape parameters.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
filePath | Yes | Path to the JSON file to filter | |
shape | No | Shape object (formatted as valid JSON) defining what fields to extract. Use 'true' to include a field, or nested objects for deep extraction. Examples: 1. Extract single field: {"type": true} 2. Extract multiple fields: {"type": true, "version": true, "source": true} 3. Extract nested fields: {"appState": {"gridSize": true, "viewBackgroundColor": true}} 4. Extract from arrays: {"elements": {"type": true, "x": true, "y": true}} - applies to each array item 5. Complex nested extraction: { "type": true, "version": true, "appState": { "gridSize": true, "viewBackgroundColor": true }, "elements": { "type": true, "text": true, "x": true, "y": true, "boundElements": { "type": true, "id": true } } } Note: - Arrays are automatically handled - the shape is applied to each item in the array. - Use json_schema tool to analyse the JSON file schema before using this tool. |