VSCode style fuzzy search for JSON documents
- Use VSCode style fuzzy search on a JSON document
- Searches through key names, path, raw values and formatted values
Install Fuzzy JSON Search
$ npm install --save @jsonhero/fuzzy-json-search
The simplest way to search is to create an instance of JSONHeroSearch
and pass it a JSON object:
const response = await fetch("https://jsonplaceholder.typicode.com/todos");
const json = await response.json();
const searcher = new JSONHeroSearch(json);
const results = searcher.search("user");
Performs a fuzzy search against the entire document, ordering by score. Will only return results that score more than 0.
SearchResult<string>
has the following properties: