<commit_before>import org.codehaus.groovy.grails.web.converters.Converter;

import grails.converters.JSON
import hello.World


class JsonBootStrap {
    def init = { servletContext ->
        JSON.registerObjectMarshaller(World, { World world, Converter converter ->
            [id: world.id, randomNumber: world.randomNumber]
        })
    }
}<commit_msg>use JSONWriter API for custom JSON marshaller<commit_after>import org.codehaus.groovy.grails.web.converters.Converter
import org.codehaus.groovy.grails.web.json.JSONWriter
import grails.converters.JSON
import hello.World

@groovy.transform.CompileStatic
class JsonBootStrap {
    def init = { servletContext ->
        JSON.registerObjectMarshaller(World, { World world, Converter converter ->
            JSONWriter writer = (JSONWriter)converter.writer
            writer.object()
            writer.key('id').value(world.id)
            writer.key('randomNumber').value(world.randomNumber)
            writer.endObject()
            null
        })
    }
}
{'fraction_non_alphanumeric': 0.09931170108161258, 'fraction_numerical': 0.0, 'mean_word_length': 3.072, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5622059', 'n_tokens_mistral': 300, 'n_tokens_neox': 291, 'n_words': 53}