Package com.codedjson

Class Json

  • Direct Known Subclasses:
    Decode

    public class Json
    extends Is
    All JSON related operations are written in this class.
    • Method Detail

      • isContentJson

        public boolean isContentJson()
        Checks if the deserialized object is of json type
        Returns:
        boolean
      • isContentJson

        public static boolean isContentJson​(String content)
        Checks if the passed content is of json type.
        Parameters:
        content - Test content in string
        Returns:
        boolean
      • isContentJson

        public static boolean isContentJson​(Path path)
        Checks if the file content is of json type.
        Parameters:
        path - File path
        Returns:
        boolean
      • getAllKeys

        public List<String> getAllKeys()
        Iteratively parses all keys and returns it in List< String>
        Returns:
        List< String> of all the keys
      • getValueFromKey

        protected Object getValueFromKey​(String key)
      • getAllValues

        public List<Object> getAllValues()
                                  throws NullJsonKeys
        Iteratively parses all values and returns it in List< String>.
        Requires getAllKeys() before.
        Returns:
        List< String> of all the keys
        Throws:
        NullJsonKeys - If getAllKeys() is not called before
      • parse

        public Object parse()
        Parse value with no keys. Returns the root json object
        Returns: