
Security News
Django Joins curl in Pushing Back on AI Slop Security Reports
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
json-locator
Advanced tools
Because all the good names (json-query, json-select, etc) were all taken up, I'm forced to use this name.
Essentially a thin wrapper around the excellent jsonpath
library. The JSONPath specification is sketchy (I mean look at that website, 2007?) and not many people use it, but I needed something that would refer to specific nodes or groups of nodes.
var locator = require('json-locator');
var data = {
colors: [
{ type: 'additive', name: 'red', red: 255, green: 0, blue: 0 },
{ type: 'additive', name: 'green', red: 0, green: 255, blue: 0 },
{ type: 'additive', name: 'blue', red: 0, green: 0, blue: 255 },
{ type: 'subtractive', name: 'cyan', red: 0, green: 255, blue: 255 },
{ type: 'subtractive', name: 'magenta', red: 255, green: 0, blue: 255 },
{ type: 'subtractive', name: 'yellow', red: 255, green: 255, blue: 0 },
{ type: 'subtractive', name: 'black', red: 0, green: 0, blue: 0 }
]
};
locator.transform('colors[type="subtractive"][red<100]');
// expected colors[?(@.type=="subtractive" && @.red<100)]
locator.query(data, 'colors[type="subtractive"][red<100]');
// expected [ { ... name: 'cyan' ...}, { ... name: 'black' ...} ]
The npm module jsonpath has an excellent implementation and looks well maintained but:
==
instead of =
and boolean operators like &&
.@
syntax which is unnecessary 99% of the time.I wanted to filter something like:
"inputs": [
{
"type": "dropdown",
"data": {
"name": "Memory",
"hasPricing": true,
"hasFrequency": false,
"options": [
{
"name": "one",
"price": "23",
"frequency": ""
},
{
"name": "two",
"price": "99",
"frequency": ""
}
]
}
}
]
with an expression such as
inputs[type="dropdown"][data.hasPricing].data.options[*].price
and get back
["23", "99"]
and not have to use an expression like
inputs[?(@.type=="dropdown" && @.data.hasPricing)].data.options[*].price
FAQs
Wrapper around jsonpath module
The npm package json-locator receives a total of 0 weekly downloads. As such, json-locator popularity was classified as not popular.
We found that json-locator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.