Allow setRules to set rule using JSON

This patch allow set a rule using JSON format directly