Serialize a JS object from key/value pairs that use square-bracket notation