beanmo / json-find Goto Github PK
View Code? Open in Web Editor NEWSimple key search
License: ISC License
Simple key search
License: ISC License
json-find.js line:197
function isObject(v) {
return typeof(v) === 'object' && !isArray(v);
}
modify:
function isObject(v) {
return typeof(v) === 'object' && !isArray(v) && v !== null;
}
Hi,
when trying to create an optimized build with create-react-app
it fails throwing this error:
Failed to minify the code from this file:
./node_modules/json-find/json-find.js:17
So this line:
https://github.com/BeAnMo/json-find/blob/master/json-find.js#L17
let res2 = {
list: {
a:undefined,
blur:1
},
}
let doc = JsonFind(res2);
let is_private = doc.checkKey('is_private');
TypeError: Cannot convert undefined or null to object
Thanks for an awesome utility! I'm having an unexplained failure to find a certain key, though. In this example...
const doc1 = {
"arr1": [
{
"arr2": [
{
"a": 1,
"arrTarget": [
{
"b": 2
},
{
"keyTarget": "target value"
}
]
}
]
}
]
}
... jsonFind(doc1).findValues("keyTarget")
returns an empty object. However, remove the object before the target object:
const doc2 = {
"arr1": [
{
"arr2": [
{
"a": 1,
"arrTarget": [
{
"keyTarget": "target value"
}
]
}
]
}
]
}
... and it returns target value
as expected. It also works when {"keyTarget": "target value"}
is followed by another object.
[extractPaths mehtod ]: Why not return a null character when the field is not found, but return an error?
Because the data is dynamic, it cannot guarantee absolute integrity.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.