Fix generating JSON from all-empty, all-optionals

If a buf contains only optionals (ie, the fields are all Options) AND all those fields are empty, the resulting JSON object will be malformed. Since nothing is printed in the object, the opening bracket will be eaten by the [sb.length -= 1].
This hopefully fixes that.