Think differently: It's not about placing gern "on either side" of the object, the basic rule is that adverbs that modify other parts of the sentence ("nicht", "auch", ...) are placed directly in front of the part they modify. So in "... gern Gemüse", gern applies specifically to Gemüse.
This is also true if an adverb modifies a verb. However, in a main clause, the verb must be in second position, so you can't place an adverb directly in front of the verb. Instead, the adverb is placed at the very end, just like infinitives and participles that extend the verb. You can see this when you switch to a subclause, or when you introduce an auxiliary: Then the adverb can again be placed in front of the verb.
So the relationships are:
Ich esse (nicht) gern Gemüse -> ..., weil ich (nicht) gern Gemüse esse.
Ich esse Gemüse (nicht) gern -> ..., weil ich Gemüse (nicht) gern esse.
Ich mag Gemüse (nicht) gern -> ..., weil ich Gemüse (nicht) gern mag.
So in the first example, the nuance is that it's the vegetables you're not really fond of, and in the two other examples, the whole action is qualified. Of course you can use "nicht so" instead of "nicht" everywhere.
As with any parts of the sentence, you can also move the adverb to the front, where it is (rather strongly, in this case) emphasized:
(So) Gern mag ich Gemüse nicht.
Nicht (so) gern mag ich Gemüse.
So that is also correct.