The JSON output for SPARQL is documented in SPARQL 1.1 Query Results JSON Format, and specifically section 3.2.2 Encoding RDF Terms describes how the RDF is encoded in the JSON. Note that the JSON output is really just for encoding the results of a SPARQL query, not for creating JSON objects that correspond to a particular object model. Your best bet is probably to take the results you're getting and manipulate them yourself. There are still a few things that might be helpful from the SPARQL side, though.

group_concat for combining values

That said, maybe the following can help you get something that will work a bit better for you. If you have data like this:

If you ask for the results in JSON format, you'll get the following output, which might work for you, depending on what kinds of entities your b1–b4 are. Specifically, if they're strings, where concatenation makes sense, this could be fine. If they're something else, it's probably not so useful.

group_concat with construct

There are JSON serializations of RDF out there, and while they may not be supported by SPARQL engines, you could use a construct query to generate some RDF that is structured more like your desired form, and then use an RDF serialization converter to convert to a JSON format. For instance, Jena's rdfcat supports RDF/JSON output. Using a construct query like this: