Class JSONUtil


  • public final class JSONUtil
    extends java.lang.Object
    JSON Utils
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String formatError​(java.lang.String strMessage, int nCode)
      Format error as JSON
      static com.fasterxml.jackson.databind.node.ObjectNode json​(java.util.Map model)
      Convert a model into a JSON object
      static java.lang.String model2Json​(java.util.Map model)
      Convert a model into a JSON formatted string
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • model2Json

        public static java.lang.String model2Json​(java.util.Map model)
        Convert a model into a JSON formatted string
        Parameters:
        model - The model
        Returns:
        The JSON string
      • json

        public static com.fasterxml.jackson.databind.node.ObjectNode json​(java.util.Map model)
        Convert a model into a JSON object
        Parameters:
        model - The model
        Returns:
        The JSON Object
      • formatError

        public static java.lang.String formatError​(java.lang.String strMessage,
                                                   int nCode)
        Format error as JSON
        Parameters:
        strMessage - the error message
        nCode - The error code
        Returns:
        The formatted string