Comments (10)
Yeah, I have plans to add support for writing JSON when I have some time
from jsonparser.
First implementation of Set
is merged :)
from jsonparser.
That would definitely be convenient. Perhaps it could work using primitives like searchKeys
and/or Get
to find the location of the key/value to be modified, and then splice the preceding and following JSON around a modified key/value. Getting the trailing comma right would be a small wrinkle (it is context-sensitive depending on whether another key/value follows), but not insurmountable.
I don't really have the time or work-related need to develop this right now, unfortunately ๐.
from jsonparser.
As a workaround for now, you could probably copy and repurpose the current searchKeys
/Get
code (as those functions compute the begin and end offsets of a key-value pair as part of their job) and implement that splicing strategy yourself. If you do, please post your experience and/or code here, as it may be a good basis for incorporating this feature in the future.
from jsonparser.
I have another use that is different than @pavelnikolov. I want to write a function (middleware) that takes a JSON object and nullifies fields that are considered PII (personally identified information) given a set paths that have been identified as such (or equally.. allow a set of paths that are whitelisted) given the role of the user requesting it.
So:
{ "name": "John Doe", "color": "blue" }
// pass through middleware
{ "name": null, "color": "blue" }
from jsonparser.
from jsonparser.
@buger Nice, I did thanks. Anything I can help with to get this PR reviewed and merged?
from jsonparser.
You can help by testing and reviewing it :)
from jsonparser.
I did look at the PR before and left a comment (not actually related to the feature itself, but one you likely can answer). I will pull down and test it out shortly. I did notice there were no benchmarks for the set operations.
from jsonparser.
I started #102 to move forward the work from #98 if folks want to take a look and help get it reviewed for merge :)
from jsonparser.
Related Issues (20)
- How to break in ArrayEach ?
- Continuing iteration in ArrayEach() HOT 1
- The set function does not work
- package github.com/buger/jsonparser is not a main package HOT 3
- Get call panics on empty json array or invalid json with an empty path - expecting an error to be returned
- [Proposal] New function based on EachKey
- Iterator support for Arrays & Objects
- Dead / Faulty code in ArrayEach? HOT 2
- The maximum number of byte files that ArrayEach supports
- Security - CVE-2020-10675 HOT 5
- Are there plans to release a new version๏ผ
- I don`t why it is not work
- how can i get length of array attribute
- ArrayEach correct behaviour
- Delete func data cannot has blank character
- Why were the patch versions for CVE-2020-10675 released so late?
- How to get key by index? HOT 3
- Set with index overrides always first position of the array
- Set() doesnt return a normal json data
- Add Native Support for Retrieving uint64
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsonparser.