JsonUtilities in build.cs makes Unreal crashed

I tried to make my FPS game to be able to GET and POST data to my database. I succeded on the GET method, but when I try to POST by adding JsonObjectConverter.h to my include, it won’t build at first. But after I clean, reopen, and rebuild, it finally succeeded. There’s still some errors like below :

Now that I run the unreal engine project and start, it immediately crashed.

Any solution to this problem?

Hmmm… try adding just “Json.h” and see if it helps with json compiling in. Also make sure you are including IImageWrapper.h and IImageWrapperModule.h in your Texture.h file.

If you haven’t yet then add
“Json”,
“JsonUtilities”

to your Build.cs dependancies.

thankyou for replying.
I tried adding the “Json.h”, but turns out there’s a whole lot errors on the Texture.h file which I didnt edit before.

Here’s the Texture.h file:

thankyou for replying.
I already did add those like so:

You shouldn’t edit the Engine headers unless you really need to, the error regarding IImageWrapper and IImageWrapperModule show up if there are build errors in general, at least that is my experience. So I’d revert that file [Texture.h].

The real error is the Incomplete type which means you are missing a header(s) for one or more of the classes you are using.

okay, i’ll revert the Texture.h file. But I still can’t figure out what’s missing.

Go through all your recent changes before the error, each class you are using check that there is a corresponding header, at least where it makes sense.

Are you using Forward Declaration in your headers?
You can comment out any new classes and the related code you are using in your cpp. Then Forward Declare in your header file. Slowly add the code back into your cpp and build until you hit the Incomplete type error, then you can get the header from Unreal documentation and add it to your cpp. Rinse and repeat.

You can also drop screenshots here of your header and the top of your cpp, maybe someone can spot the issue.

It all went fine until I added the POST method like below :

It works fine when its for GET method. But when I add the POST which need to add “JsonObjectConverter.h” on my include, it still build successfully, but when i run it on the Unreal Engine, it crashes immediately.

Here’s the include on the top of my cpp:
#include “FinalFPSGameMode.h”
#include “FinalFPSCharacter.h”
#include “Json.h”
#include “JsonObjectConverter.h”
#include “UObject/ConstructorHelpers.h”

What is the type of “Request”?

Here’s the full one:

Try adding this to your cpp

#include “Http.h”

sorry for the late reply, the loading took so long.

I added the “Http.h”, rebuild it, succeded, run it on the Unreal engine, still crash

Oh I think it crashed because there’s a typo I did.
It should be “Content-Type”, not “ContentType”.

1 Like