# Array Filter

Filter out elements of specific types from arrays (remove numbers, strings, booleans, etc.)

> Canonical page: https://elysiatools.com/en/tools/array-filter

- **Category:** Data Processing

- **Keywords:** array, filter, remove, exclude, type, numbers, strings, booleans, objects, clean, purify

## Overview

The Array Filter tool allows you to quickly clean and refine your data by removing specific element types from arrays, such as integers, floats, strings, or boolean values.

## Inputs

- **Input Array** (textarea): Enter array as JSON format: \[3, 1, 2\] or comma-separated values: 3, 1, 2 or one per line
- **Filter Type (Remove)** (select)
- **Include Null Values (保留Null值)** (checkbox)
- **Include Undefined Values (保留Undefined值)** (checkbox)
- **Case Sensitive (for strings)** (checkbox)
- **Trim Whitespace (for strings)** (checkbox)
- **Custom Separator (for text input)** (text): Enter separator (default: comma, semicolon, or newline)

## When to use

- When you need to sanitize raw data by stripping out unwanted data types before processing.
- When you have mixed-type arrays and need to isolate specific values for analysis.
- When preparing JSON datasets for API integration by removing null or undefined entries.

## How it works

- Paste your array into the input field using JSON format, comma-separated values, or one item per line.
- Select the specific data type you wish to remove from the 'Filter Type' dropdown menu.
- Adjust optional settings like 'Include Null Values' or 'Trim Whitespace' to refine your output.
- Click the process button to generate your cleaned array instantly.

## Use cases

- Cleaning API responses that contain mixed data types.
- Preparing numeric datasets for mathematical operations by removing stray strings.
- Filtering out boolean flags from configuration arrays.

## Frequently asked questions

### What input formats does this tool support?

You can provide data as a standard JSON array, comma-separated values, or by placing each element on a new line.

### Can I remove multiple types at once?

Currently, the tool processes one filter type at a time to ensure precise data cleaning.

### Does this tool handle nested arrays?

This tool is designed to filter elements within a single-level array.

### Is the filtering case-sensitive for strings?

Yes, you can toggle the 'Case Sensitive' option to control how string filtering is applied.

### What happens to null or undefined values?

You can choose to keep or remove null and undefined values using the dedicated checkboxes in the configuration settings.

## Related tools

- [Array Deduplicator](https://elysiatools.com/en/tools/array-deduplicator): Remove duplicate elements from arrays with various deduplication methods
- [Compact Array](https://elysiatools.com/en/tools/compact-array): Remove falsey values from array using lodash _.compact
- [BOM Character Remover](https://elysiatools.com/en/tools/data-bom-remover): Remove BOM (Byte Order Mark) characters from text and file content. Perfect for cleaning up text files that have encoding issues, fixing CSV imports, and preparing data for processing. Features: - Detect and remove UTF-8 BOM (EF BB BF) - Detect and remove UTF-16 BOM (FE FF or FF FE) - Detect and remove UTF-32 BOM (00 00 FE FF or FF FE 00 00) - Support multiple input formats - Visual BOM character display - Detailed detection report - Support for batch text processing Common Use Cases: - Fix CSV file import errors - Clean up text file encoding issues - Prepare data for JSON parsing - Fix XML parsing problems - Resolve API data encoding conflicts - Standardize text data format
- [Array Element Deleter](https://elysiatools.com/en/tools/array-element-deleter): Delete specific elements from arrays with support for multiple deletion methods
- [Line Number Remover](https://elysiatools.com/en/tools/line-number-remover): Remove line numbers from text or code with intelligent pattern recognition
- [Chinese Character Extractor (汉字提取器)](https://elysiatools.com/en/tools/chinese-character-extractor): Extract all Chinese characters from text, filtering out punctuation and English letters, numbers, and non-Chinese symbols
- [Data Deduplicator](https://elysiatools.com/en/tools/data-deduplicator): Remove duplicate rows from CSV files based on multiple column combinations. Perfect for cleaning customer lists, survey responses, and database exports. Features: - Multi-column combination deduplication - Fuzzy matching for similar records - Custom deduplication strategies (keep first, last, or most complete record) - Case-insensitive matching option - Whitespace trimming - Detailed duplicate statistics Common Use Cases: - Remove duplicate customer records - Clean email marketing lists - Eliminate redundant survey responses - Prepare data for analysis
- [Emoji Extractor](https://elysiatools.com/en/tools/emoji-extractor): Extract all Unicode emoji from text, or optionally remove emojis

## Samples

- [Duplicate Line Samples](https://elysiatools.com/en/samples/text-duplicate-line-samples): Sample files with various types of duplicate lines for testing duplicate removal tools
- [Special Characters Samples](https://elysiatools.com/en/samples/text-special-characters-samples): Sample text files with various special characters, punctuation, and symbols for testing non-alphanumeric character removal
- [Code Comment Samples](https://elysiatools.com/en/samples/code-comment-samples): Sample code files with various comment styles for testing comment removal
- [Android File Operations Java Samples](https://elysiatools.com/en/samples/android-file-operations-java): Android Java file operations examples including text file read/write, file copy/move, directory traversal, and file validation

## Related content

- [Array and List Data Organization Tools](https://elysiatools.com/en/hubs/array-and-list-manipulation-tools): Inspect, clean, filter, deduplicate, reshape, slice, and order arrays or lists for downstream data use.
