Here you can find the source of toJSONString(Object object, boolean camelCaseToLowerCaseWithUnderscores)
public static String toJSONString(Object object, boolean camelCaseToLowerCaseWithUnderscores) throws Exception
//package com.java2s; //License from project: Apache License import com.fasterxml.jackson.databind.ObjectMapper; public class Main { private final static ObjectMapper OBJECT_MAPPER = new ObjectMapper(); private final static ObjectMapper LCWU_OBJECT_MAPPER = new ObjectMapper(); public static String toJSONString(Object object, boolean camelCaseToLowerCaseWithUnderscores) throws Exception { ObjectMapper mapper = camelCaseToLowerCaseWithUnderscores ? LCWU_OBJECT_MAPPER : OBJECT_MAPPER; return mapper.writeValueAsString(object); }/*from w w w. j av a2s . c o m*/ public static String toJSONString(Object object) throws Exception { return toJSONString(object, false); } }