I have not entirely understood your business logic, but I think this will give you what you need.
Which will turn
<GBAreal xsi:nil="true" />
The key to this is duplicating the GBAreal element in the output
The first instance of GBAreal causes the element to be written out when the JSON value is 'null', we add the constant 'true' to force the nil attribute to be set to 'true'.
The second instance of GBAreal causes an element to be written when the JSON value is a number.
If GBAreal is not present then nothing is output.
Note: It is not possible for them both to be written out (resulting in 2 GBAreal elements) as the JSON source property can either contain a value (number) or be null (it can't be both) so only a max of one of them will ever be used.