Added json writer code.