save rules.json to file. started work on restoring rules from file