Ambigous TJsonObject in WEBLib.REST and WEBLib.JSON

Didn't notice that one previously:

Is there a specific reason why WEBLib.REST declares its own (minimalistic) TJsonObject instead of using what's already in WEBLib.JSON?

It's quite a bit confusing if you have the wrong order in your uses and wonder why your TJSONObjects don't compile anymore, because they miss a lot of functionality in WEBLib.REST :slight_smile:

I think you are looking at the code for the design-time, i.e. the code to keep the LSP happy in folder "Component Library Source".
The runtime code is under "Core Source" and there in WEBLib.REST.pas, the TJSONObject is used as defined in WEBLib.JSON.pas

Correct, the runtime code in WebLibRest.pas references WebLibJson and does not introduce its own TJSONObject implementation.

Though, wouldn't it be possible to do the same thing in the design time source?

If you don't have both units in the correct order in your uses clause, then LSP resolves against the simplistic JSON classes in WebLibRest - which leads to a lot of red underlines if my code makes use of the advanced features as in WebLibJson

Not a pressing issue, but might make life easier, esp. for Web Core beginners ;-)

Good suggestion. We cleaned this up. Next update will address this.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.