package edu.grinnell.callaway.jsonvalues;

import java.util.HashMap;
import java.util.Set;

public class JSONObject
    implements
      JSONValue
{

  HashMap<JSONString, JSONValue> object;

  public JSONObject(HashMap<JSONString, JSONValue> object)
  {
    this.object = object;
  }

  public String toJSON()
  {
    StringBuilder str = new StringBuilder();
    str.append('{');
    HashMap<JSONString, JSONValue> hash = this.object;
    Set<JSONString> keys = hash.keySet();
    for ( JSONString key : keys )
      {
        str.append(key.toJSON());
        str.append(hash.get(key).toJSON());
      }
    str.append(']');
    return str.toString();
  }
}

@@ -372,11 +372,12 @@
 end(
-'%7B'
+%22%7B %22
 );%0A 
@@ -571,30 +571,80 @@
 end(
-hash.get(key).toJSON()
+':');%0A        str.append(hash.get(key).toJSON());%0A        str.append(' '
 );%0A 
@@ -670,9 +670,9 @@
 nd('
-%5D
+%7D
 ');%0A

add ':' and spaces to objects