
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Easy package to write JSON files
jsonwriter
is an easy JSON writer, when i say easy i mean super easy
pip install jsonwriter
True
every change you make will be automatically savedfrom jsonwriter import file
file = file('filename.json', autosave=True)
file.set('key', 'value') # This will be saved automatically
file.save()
whenever you want to save your changesfrom jsonwriter import file
file = file('filename.json', autosave=False)
file.set('key', 'value')
file.set('key2', 'value2')
file.save() # Now, it will be saved
Let's say this is our file content:
{
"name": "Nawaf",
"age": 10
}
get(key)
file.get('name') # Will return Nawaf
file.get('age') # Will return 10
set(key, value)
file.set('Skills', ['Sleeping', 'Coding'], indent=3)
# indentation will make it more readable
# 3 is recommended/default value
# set() Can also update values
file.set('age', 100)
File will get updated to
{
"name": "Nawaf",
"age": 100,
"Skills": [
"Sleeping",
"Coding"
]
}
If we set the indentation to 0
this is what we will get
{"name": "Nawaf", "age": 100, "Skills": ["Sleeping", "Coding"]}
remove(key)
file.remove('name') # This will just remove "name": "Nawaf"
clear()
file.clear() # Warning! This will remove everything from your file
hasKey(key)
file.hasKey('age') # return True
hasValue(value)
file.hasValue(10) # return True
hasAll(key or value)
file.hasAll('age') # return True
file.hasAll(10) # return True
from jsonwriter import file
file = file('filename.json', autosave=True)
print(file.content)
# This will show your file content
# Note: if you are not using autosave this will show all the changes, even if they are not saved
print(file.keys)
# This will show all the keys
print(file.values)
# This will show all the values
FAQs
Easy JSON Writer
We found that jsonwriter demonstrated a healthy version release cadence and project activity because the last version was released less than 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.