Package jminusminus

Class JSONElement

java.lang.Object
jminusminus.JSONElement

class JSONElement extends Object
Representation of an element with a JSON document.
  • Constructor Details

    • JSONElement

      public JSONElement()
      Constructs an empty JSON element.
  • Method Details

    • addAttribute

      public void addAttribute(String name, String value)
      Adds an attribute to this JSON element with the given name and value.
      Parameters:
      name - name of the attribute.
      value - value of the attribute.
    • addAttribute

      public void addAttribute(String name, ArrayList<String> value)
      Adds an attribute to this JSON element with the given name and value as a list of strings.
      Parameters:
      name - name of the attribute.
      value - value of the attribute as a list of strings.
    • addChild

      public void addChild(String name, JSONElement child)
      Adds a child to this JSON element with the given name.
      Parameters:
      name - name of the child.
      child - the child.
    • toString

      public String toString()
      Returns a string representation of this JSON element.
      Overrides:
      toString in class Object
      Returns:
      a string representation of this JSON element.