https://github.com/abdheshnayak/search-in-json
Search in json with unknown schema.
https://github.com/abdheshnayak/search-in-json
fastsearch json path search
Last synced: 3 months ago
JSON representation
Search in json with unknown schema.
- Host: GitHub
- URL: https://github.com/abdheshnayak/search-in-json
- Owner: abdheshnayak
- License: mit
- Created: 2023-09-20T19:33:19.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-11T17:50:43.000Z (9 months ago)
- Last Synced: 2025-07-08T08:08:27.335Z (4 months ago)
- Topics: fastsearch, json, path, search
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/search-in-json
- Size: 2.11 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# Search In Json (with unknown schema)
This is a simple tool to find the path of a key in a JSON object. You can use it to find the path of a key in a JSON object, and then use the path to get the value of the key.
**[Code SandBox Link](https://codesandbox.io/s/search-in-json-d2x8qs?file=/src/App.js)**

## Example
```js
import { search } from 'search-in-json';
import { data } from './data';
console.log(
search({
data,
text: 'order',
debug: true,
ignoreCamelCase: true,
})
);
```
## Exmple2 with regex
```js
import { search } from 'search-in-json';
import { data } from './data';
console.log(
search({
data,
debug: true,
ignoreCamelCase: true,
regex: /order/gi,
})
);
```
## Result Sample
```json
{
"result": [
{
"key": "_embedded.episodes[1].summary",
"index": 239,
"endIndex": 244
},
{
"key": "_embedded.episodes[59].summary",
"index": 137,
"endIndex": 142
}
]
}
````