Package org.noggit

Class JSONUtil


  • public class JSONUtil
    extends Object
    • Field Detail

      • TRUE_CHARS

        public static final char[] TRUE_CHARS
      • FALSE_CHARS

        public static final char[] FALSE_CHARS
      • NULL_CHARS

        public static final char[] NULL_CHARS
      • HEX_CHARS

        public static final char[] HEX_CHARS
    • Constructor Detail

      • JSONUtil

        public JSONUtil()
    • Method Detail

      • toJSON

        public static String toJSON​(Object o,
                                    int indentSize)
        Parameters:
        o - The object to convert to JSON
        indentSize - The number of space characters to use as an indent (default 2). 0=newlines but no spaces, -1=no indent at all.
      • writeNumber

        public static void writeNumber​(int number,
                                       CharArr out)
      • writeNumber

        public static void writeNumber​(long number,
                                       CharArr out)
      • writeNumber

        public static void writeNumber​(float number,
                                       CharArr out)
      • writeNumber

        public static void writeNumber​(double number,
                                       CharArr out)
      • writeString

        public static void writeString​(CharArr val,
                                       CharArr out)
      • writeString

        public static void writeString​(char[] val,
                                       int start,
                                       int end,
                                       CharArr out)
      • writeString

        public static void writeString​(String val,
                                       int start,
                                       int end,
                                       CharArr out)
      • writeString

        public static void writeString​(CharSequence val,
                                       int start,
                                       int end,
                                       CharArr out)
      • writeStringPart

        public static void writeStringPart​(char[] val,
                                           int start,
                                           int end,
                                           CharArr out)
      • writeChar

        public static void writeChar​(char ch,
                                     CharArr out)
      • writeStringPart

        public static void writeStringPart​(String chars,
                                           int start,
                                           int end,
                                           CharArr out)
      • writeStringPart

        public static void writeStringPart​(CharSequence chars,
                                           int start,
                                           int end,
                                           CharArr out)
      • unicodeEscape

        public static void unicodeEscape​(int ch,
                                         CharArr out)
      • writeNull

        public static void writeNull​(CharArr out)
      • writeBoolean

        public static void writeBoolean​(boolean val,
                                        CharArr out)