more work to jsonize flag creation into perl