Back to news list

Comment keys in JSON files

Posted on 2024-07-23 by Matt West

Thanks to Zander Xu and Craig Zilles, PrairieLearn now supports "comment" keys in JSON files for documentation (for example, listing learning objectives for a given question pool). Here is an example of this key:

{
    "comment": "This assessment was first created for the workshop offered in Summer 2020",
    "zones": [
        {
            "title": "Lesson 1",
            "comment": "Workshop Day 1: https://prairielearn.readthedocs.io/en/latest/workshop/lesson1/",
            "questions": [
                {"id": "workshop/PeriodicTable1", "points": 1, "maxPoints": 3},
                {"id": "workshop/Lesson1_example1_v1", "points": 1, "maxPoints": 3}
            ]
        },
        {
            "title": "Lesson 3",
            "comment": "Workshop Day 2: https://prairielearn.readthedocs.io/en/latest/workshop/lesson2/",
            "questions": [
                {"id": "workshop/Lesson2_example1_v1", "points": 1, "maxPoints": 3},
                {"id": "workshop/Lesson2_example1_v2", "points": 1, "maxPoints": 3},
            ]
        }
    ]
}

Comments can be used in any PrairieLearn JSON file, but only one comment is allowed in each JSON object. (Things wrapped in curly braces {} are JSON objects.) Comments can be strings, arrays, or objects. See the comment documentation for details.