You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.
There is an old problem with this library is that it doesn't support returning top level list JSON objects, even though that is a valid JSON response. There was a hack proposed on how to circumvent this restriction by changing it into a dict in blueprint, but that doesn't seem like a good long-term solution.
I noticed that the Deserialize function from Unreal supports parsing both list and objects at top level, and there is actually one version of it that automatically return the right top level, but as a FJsonValue rather than a FJsonObject:
I added a blueprint function to VaRequestJSON.cpp called GetResponseValue() that returns to me the Json value that results calling the function above. With that value I can then either call the 'AsObject' or 'AsArray' at the blueprint level to access the response as a top level object or as a top level list respectively. Seems to work fine, so this is maybe something you should consider.
The text was updated successfully, but these errors were encountered:
Just for your interest, this is how I am doing this now: I created an extra property called ResponseJsonVal, along with a GetResponseValue() method. In VaRequestJSON.ccp, I then replace the call to Deserialize with the following:
There is an old problem with this library is that it doesn't support returning top level list JSON objects, even though that is a valid JSON response. There was a hack proposed on how to circumvent this restriction by changing it into a dict in blueprint, but that doesn't seem like a good long-term solution.
I noticed that the Deserialize function from Unreal supports parsing both list and objects at top level, and there is actually one version of it that automatically return the right top level, but as a FJsonValue rather than a FJsonObject:
JsonSerializer.h (58) static bool Deserialize(const TSharedRef< TJsonReader<CharType> >& Reader, TSharedPtr<FJsonValue>& OutValue)
I added a blueprint function to VaRequestJSON.cpp called GetResponseValue() that returns to me the Json value that results calling the function above. With that value I can then either call the 'AsObject' or 'AsArray' at the blueprint level to access the response as a top level object or as a top level list respectively. Seems to work fine, so this is maybe something you should consider.
The text was updated successfully, but these errors were encountered: