generate json data based on rules