Package nxt.util

Class JSON


  • public final class JSON
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static org.json.simple.JSONStreamAware emptyJSON  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void encodeObject​(java.util.Map<?,​?> map, java.lang.StringBuilder sb)
      Create a formatted string from a map
      static void encodeValue​(java.lang.Object value, java.lang.StringBuilder sb)
      Encode a JSON value
      static org.json.simple.JSONStreamAware prepare​(org.json.simple.JSONObject json)  
      static org.json.simple.JSONStreamAware prepareRequest​(org.json.simple.JSONObject json)  
      static java.lang.String toJSONString​(org.json.simple.JSONAware json)
      Create a formatted JSON string
      static java.lang.String toString​(org.json.simple.JSONStreamAware jsonStreamAware)  
      static void writeJSONString​(org.json.simple.JSONStreamAware json, java.io.Writer writer)
      Write a formatted JSON string
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • emptyJSON

        public static final org.json.simple.JSONStreamAware emptyJSON
    • Method Detail

      • prepare

        public static org.json.simple.JSONStreamAware prepare​(org.json.simple.JSONObject json)
      • prepareRequest

        public static org.json.simple.JSONStreamAware prepareRequest​(org.json.simple.JSONObject json)
      • toString

        public static java.lang.String toString​(org.json.simple.JSONStreamAware jsonStreamAware)
      • toJSONString

        public static java.lang.String toJSONString​(org.json.simple.JSONAware json)
        Create a formatted JSON string
        Parameters:
        json - JSON list or map
        Returns:
        Formatted string
      • writeJSONString

        public static void writeJSONString​(org.json.simple.JSONStreamAware json,
                                           java.io.Writer writer)
                                    throws java.io.IOException
        Write a formatted JSON string
        Parameters:
        json - JSON list or map
        writer - Writer
        Throws:
        java.io.IOException - I/O error occurred
      • encodeObject

        public static void encodeObject​(java.util.Map<?,​?> map,
                                        java.lang.StringBuilder sb)
        Create a formatted string from a map
        Parameters:
        map - Map
        sb - String builder
      • encodeValue

        public static void encodeValue​(java.lang.Object value,
                                       java.lang.StringBuilder sb)
        Encode a JSON value
        Parameters:
        value - JSON value
        sb - String builder