Was the JsonUtilities API depreciated in 4.1?

Hi all,

I have a lot of Json formatted data (contained in text files) I’d like to import for further runtime processing. As a base I started with this post here. Sadly the compilator throw an error and do not recognize the Module API Specifiers. My platform is OS X (XCode).

/Users/Shared/UnrealEngine/4.1/Engine/Source/Runtime/JsonUtilities/Public/JsonObjectConverter.h:6:25: Variable has incomplete type 'class JSONUTILITIES_API' 
  1. Am I missing something in my project compilation set up with Module API (currently no tweak, monolithic mode I guess) or simply was the JsonUtilies API depreciated (not referenced in the API class list)?
  2. In latter case I guess the Json Serialization API Core’s module will do the job, right? (I would have prefered the former as Json String to UStruct suit very well my need).
  3. I encountered a similar issue with GFileManager which was depreciated but still referenced a lot in wikis and AnswerHub’s threads. Is there a quick way to check the “depreciated” state of an object/interface?

Thanks by advance, and “bravo” UE4 is really wonderful (even more with full Linux support)!

Did you figure out how to use JsonUtilities ? In 4.2, I tried adding a ref to the JsonUtilities module and it now compiles, but I get a link error. I noticed that the .lib is missing from the UE4 build.

I gave up with JsonUtilities and implemented my own data interface with the Core Json Interface (JsonObject, JsonSerializer and JsonStringReader). It works like a charm.

Update As noted above, when attempting to package your project for release it may fail to complete due to linker errors if you use the public release the engine (any version it seems). The workaround seems to be to include files from the “Engine\Source\Runtime\JsonUtilities” folder in the engine source tree for your version. Or you can as I did, compile a complete version of the engine and run from the editor it produces.

I know this is a few months old, but in case anyone else had this problem here are a few things to get you started.

First, make sure in your ProjectName.Build.cs file that you’ve added “JsonUtilities” to the PublicDependencyModuleNames collection

// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;

public ProjectName(TargetInfo Target)
{
	PublicDependencyModuleNames.AddRange(new string[] { 
		"Core", 
		"CoreUObject", 
		"Engine", 
		"InputCore"
	});

 // Keep extra dependencies separate
	PublicDependencyModuleNames.AddRange(new string[] {
		"JsonUtilities" // <============================
	});
}

And second, make sure you add the full-ish include path wherever you’re using it in your code file (.cpp):

#include "Runtime/JsonUtilities/Public/JsonUtilities.h"
#include "Runtime/JsonUtilities/Public/JsonObjectConverter.h"

A example use case: to call UStructToJsonObjectString, just make sure your struct was marked with USTRUCT() and…

FJsonObjectConverter::UStructToJsonObjectString(YourStruct::StaticStruct(), &yourStructInstance, FStringToStoreItIn, 0, 0);

in FStringToStoreItIn you should have a JSON formatted string! Enjoy.

After retrying to include JsonUtilies module, I was stuck with the same linking issue (JsonUtilities lib is missing). It works fine in editor, not for the packaged game. It seems (to confirm) this module is not runnable in game mode (/engine/Binaries/Mac do not contains the lib…) with UE4 vanilla binaries. A walk around would be to include directly the source (actually only one file) in your game module.

I should’ve noted that I’m currently running a custom build of 4.3.1 due to other reports of missing libraries that the publicly released version neglected to include. So ignoring your workaround, if you compiled your own engine branch, and used its editor to edit your project, it will package your release fine without any linking errors. I’ve updated my answer to reflect this.

However, if you metatomato (or anyone else for that matter) don’t want to compile your own engine branch I wouldn’t blame you for it. Vanilla Visual Studio can struggle with the size of its codebase (though now I have all the debugging symbols, which can be very useful for other things). Now why would Epic not distribute all the libraries in their public releases to make this easier for us all, that’s not a question I can answer.

Hi hdak1945,
Thanks for your detailed answer. Even if, after all, it’s relatively easy and straight forward to use, the UBT building process could seem tricky at the beginning to UE4 rookies as I am (docs really missing some points…). Practical and clear explanations, like yours, do really make save time (and hair) to UE4 beginners.

You’re totally right when you say “you’ll never be as well served as doing it yourself”, just compile and use your own branch. It’s really the true power of UE4, as Epic says “just take the source and do whatever you want!”. I would advise every UE4 beginners to do so! Go, compile, study and modify the UE4 sources!

I was having unresolved external symbols for Json when I was upgrading my project from V4.5 to V4.6, and this solved it for me.

PublicDependencyModuleNames.AddRange(new string[] {
    "Json"
});

Cheers!

Is this still working in 4.10? After adding json and jsonutilities I get compiler errors at JsonObjectConverter.h.

Any Solution for this issue facing the same problem…