项目作者: justuswilhelm

项目描述 :
Scrub JSON files from private information.
高级语言: Go
项目地址: git://github.com/justuswilhelm/anonymijson.git
创建时间: 2017-02-08T23:36:52Z
项目社区:https://github.com/justuswilhelm/anonymijson

开源协议:ISC License

下载


Anonymijson

Anonymise JSON data structures. The tool helps ensure that test data is
stripped of identifiable personal data and unlicensed content. This is useful
as it allows you to save time when creating new test cases or other test data
for your software. You can get started using Anonymijson provided you have Go
installed.

Scroll down for an explanation on how to install, and how to use.

Installation

Provided you have Go installed, you can simply run

  1. go get github.com/justuswilhelm/anonymijson

and as long as Go has executables in your $PATH, you can immediately start
using the command anonymijson.

Usage

  1. $ cat test.json test2.json
  1. {
  2. "1": 1.02,
  3. "bla": "lol",
  4. "hello": [
  5. 1,
  6. 2,
  7. 3
  8. ]
  9. }
  10. [
  11. [
  12. 1,
  13. 2
  14. ],
  15. 1,
  16. 2,
  17. 3
  18. ]
  1. $ anonymijson test.json test2.json
  1. === test.json ===
  2. {
  3. "1": 0.9122551027038107,
  4. "bla": "scaberulous-honeysweet",
  5. "hello": [
  6. 0.6288449008092282,
  7. 0.9233224572170322,
  8. 0.5275968199385908
  9. ]
  10. }
  11. === test2.json ===
  12. [
  13. [
  14. 0.35278562141995556,
  15. 0.5841195295045782
  16. ],
  17. 0.9718421636089548,
  18. 0.7314389548879902,
  19. 0.2812210260450312
  20. ]

Will override all values in JSON objects, while leaving they key/array/hashmap
structure. The format will be kept, so strings will be replaced by random
strings and numbers by random numbers.

Furthermore, anonymijson can be run in-place. This means that files will be
replaced directly with the randomized values, instead of outputting the result
to stdout. This can be done by running

  1. $ anonymijson test.json

The output is stored within the file provided.

  1. $ cat test.json
  1. {
  2. "1": 0.09056946229454671,
  3. "bla": "Nathaniel-bonded",
  4. "hello": [
  5. 0.8885474570694423,
  6. 0.8161380166567574,
  7. 0.4648524575247153
  8. ]
  9. }