Difficult (dynamic) query with XData

What you can do is create a transient, public property with a different name where you return the FK value in it. Then flag is with a [XDataJsonProperty] attribute so it appears in JSON.