     test "object with wrong string key delimiter" do
       assert {:error, _} = JSON.parse("{'65': 23}")
     end
+    test "consecutive booleans in array, no comma" do
+      assert {:error, _} = JSON.parse("[true false]")
+    end
+    test "comma at start of array" do
+      assert {:error, _} = JSON.parse("[,true]")
+    end
+    test "comma at end of array" do
+      assert {:error, _} = JSON.parse("[false,]")
+    end
+    test "comma at start of object" do
+      assert {:error, _} = JSON.parse("{,\"b\":true}")
+    end
+    test "comma at end of object" do
+      assert {:error, _} = JSON.parse("{\"a\":false,}")
+    end
 
   end
 end

  end

  @doc """
  Commas in arrays, outside a value. If it matches, expect another value.
  """
  def parse(<<?,, t::binary>>, c = [:array | context], output) do
    debug "Found a comma in an array, now expecting a value", t, context, output
    parse(t, [:value | c], output <> <<?,>>)
  end

  @doc """

  end

  @doc """
  Boolean true, inside an array context. Expect comma or close array.
  """
  def parse(<<?t, ?r, ?u, ?e, t::binary>>, c = [:array | context], output) do
    debug "Matched boolean 'true' inside an array", t, context, output
    parse(t, [:comma_or_close_array | c], output <> "true")
  end

  @doc """
  Boolean false, inside an array context. Expect comma or close array.
  """
  def parse(<<?f, ?a, ?l, ?s, ?e, t::binary>>, c = [:array | context], output) do
    debug "Matched boolean 'false' inside an array", t, context, output
    parse(t, [:comma_or_close_array | c], output <> "false")
  end

  @doc """
  Null, inside an array context. Expect comma or close array.
  """
  def parse(<<?n, ?u, ?l, ?l, t::binary>>, c = [:array | context], output) do
    debug "Matched null/nil inside an array", t, context, output
    parse(t, [:comma_or_close_array | c], output <> "nil")
  end

  @doc """
