001package com.nimbusds.common.json;
002
003
004import com.google.gson.Gson;
005import com.google.gson.GsonBuilder;
006
007
008/**
009 * JSON serialisation. Serialises {@code null} values.
010 */
011public final class JSON {
012        
013        
014        private static final Gson GSON = new GsonBuilder().serializeNulls().create();
015        
016        
017        /**
018         * Serialises the specified object to a JSON string. Unicode characters
019         * are not escaped.
020         *
021         * @param obj The object.
022         *
023         * @return The JSON string.
024         */
025        public static String toJSON(final Object obj) {
026                
027                return GSON.toJson(obj);
028        }
029}