def METHOD_NAME(syntax_module):
    """Tests if the to_json and from_json (and by extension to_dict and from_dict)
    work for all examples in the Example Gallery.
    """
    for filename in iter_examples_filenames(syntax_module):
        source = pkgutil.get_data(syntax_module.__name__, filename)
        chart = eval_block(source)
        if chart is None:
            raise ValueError(
                f"Example file {filename} should define chart in its final "
                "statement."
            )
        try:
            first_json = chart.to_json()
            reconstructed_chart = alt.Chart.from_json(first_json)
            # As the chart objects are not
            # necessarily the same - they could use different objects to encode the same
            # information - we do not test for equality of the chart objects, but rather
            # for equality of the json strings.
            second_json = reconstructed_chart.to_json()
            assert first_json == second_json
        except Exception as err:
            raise AssertionError(
                f"Example file {filename} raised an exception when "
                f"doing a json conversion roundtrip: {err}"
            ) from err