public static String toJson(Object obj) {
        try {
            return mapper.writeValueAsString(obj);
        } catch (JsonProcessingException e) {
            throw new NacosSerializationException(obj.getClass(), e);
        }
    }
@Test
    void testToJson1() {
        assertEquals("null", JacksonUtils.toJson(null));
        assertEquals("\"string\"", JacksonUtils.toJson("string"));
        assertEquals("30", JacksonUtils.toJson(new BigDecimal(30)));
        assertEquals("{\"key\":\"value\"}", JacksonUtils.toJson(Collections.singletonMap("key", "value")));
        assertEquals("[{\"key\":\"value\"}]",
                JacksonUtils.toJson(Collections.singletonList(Collections.singletonMap("key", "value"))));
        assertEquals("{\"aLong\":0,\"aInteger\":1,\"aBoolean\":false}", JacksonUtils.toJson(new TestOfAtomicObject()));
        assertEquals("{\"date\":1626192000000}", JacksonUtils.toJson(new TestOfDate()));
        // only public
        assertEquals("{\"publicAccessModifier\":\"public\"}", JacksonUtils.toJson(new TestOfAccessModifier()));
        // getter is also recognized
        assertEquals("{\"value\":\"value\",\"key\":\"key\"}", JacksonUtils.toJson(new TestOfGetter()));
        // annotation available
        assertEquals(
                "{\"@type\":\"JacksonUtilsTest$TestOfAnnotationSub\",\"date\":\"2021-07-14\",\"subField\":\"subField\","
                        + "\"camelCase\":\"value\"}", JacksonUtils.toJson(new TestOfAnnotationSub()));
    }