Jsonstructor

Latest version: v0.0.10

Safety actively analyzes 685670 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 2 of 2

0.0.4

Overview
Added the `JsonUnion` class is designed to merge multiple JSON files or dictionaries into a single JSON file, with an option to handle duplicate keys.

Features
Merge multiple JSON sources.
Optional handling of duplicate keys.

Usage

Initialization
Create an instance of JsonUnion by passing the JSON sources and the output file path. Optionally, set replace_duplicates to True to enable replacing duplicate keys.
Python
json_union = JsonUnion('file1.json', {'key': 'value'}, JsonFile('file2.json'), 'output.json', replace_duplicates=True)


Merging
Call the `merge()` method to perform the merge operation.
Python
json_union.merge()

If replace_duplicates is set to False, a KeyError will be raised upon encountering duplicate keys.

0.0.3

The methods `update_key`, `add_key`, and `remove_key` have been improved to support nested key-value pairs. Users can now specify paths to nested objects using the `/` separator to update, add, or remove entries in JSON files.

python
file.update_key('key1/key2', 'new2')

0.0.2

Added `update_key` method to `JsonFile` class.

0.0.1

Page 2 of 2

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.