write_json function

Output a learner or grid in JSON format