Skip to content

epicreach/JSON-datacopier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

JSON-datacopier

How to use

Simply clone the repository and run. You have 2 options:

  • Remove key-value pairs from objects: This makes a copy of the JSON file and removes the specified key-value pair from every object that contains it. For example, if your JSON file looks like this:

    [
      {
        "name": "John",
        "job": "Janitor",
        "income": 1234,
        "married": true
      },
      {
        "name": "Carl",
        "job": "Musician",
        "income": 0,
        "married": false
      }
    ]

    and you input "name" and "income" as filters, the copied JSON file will look like this:

    [
      {
        "job": "Janitor",
        "married": true
      },
      {
        "job": "Musician",
        "married": false
      }
    ]
  • Remove objects with key-value pairs: This will remove any object that has a specified value for the specified key. For example, if you input "name" for the key and "John" for the value, it will remove any objects that have "John" as the value for "name". The new JSON file will be saved as a copy.

Saving

The copied JSON file will be saved in the same folder as the main.py file.

Encoding Issues

If you're having issues copying due to encoding problems, you can change the encoding='utf-8' in

with open(json_file_path, 'r', encoding='utf-8') as in_file:

to whatever encoding you need

About

Modify/Add/Remove key-value pairs in JSON-files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages