You aren't going to be able to do this using
json_encode because it's not valid JSON. (Keyspace collision)
You are going to need to assemble the object manually.
You might consider creating the individual items, then using
implode(). Then you can prepend and append
This would actually feel cleaner to me then hacking away at PHP to get json encoding to work.
I'm a big fan of the Solarium Project for PHP and Solr.
Bulk Adds and pretty easy take a look here: http://wiki.solarium-project.org/index.php/V2:BufferedAdd_plugin