void FProjectDescriptor::Write(TJsonWriter<>& Writer) const
{
	Writer.WriteObjectStart();

	// Write all the simple fields
	Writer.WriteValue(TEXT("FileVersion"), EProjectDescriptorVersion::Latest);
	Writer.WriteValue(TEXT("EngineAssociation"), EngineAssociation);
	Writer.WriteValue(TEXT("Category"), Category);
	Writer.WriteValue(TEXT("Description"), Description);

	// Write the module list
	FModuleDescriptor::WriteArray(Writer, TEXT("Modules"), Modules);

	// Write the plugin list
	FPluginReferenceDescriptor::WriteArray(Writer, TEXT("Plugins"), Plugins);

	// Write the target platforms
	if ( TargetPlatforms.Num() > 0 )
	{
		Writer.WriteArrayStart(TEXT("TargetPlatforms"));
		for(int Idx = 0; Idx < TargetPlatforms.Num(); Idx++)
		{
			Writer.WriteValue(TargetPlatforms[Idx].ToString());
		}
		Writer.WriteArrayEnd();
	}

	// If it's a signed sample, write the name hash
	if(EpicSampleNameHash != 0)
	{
		Writer.WriteValue(TEXT("EpicSampleNameHash"), FString::Printf(TEXT("%u"), EpicSampleNameHash));
	}

	Writer.WriteObjectEnd();
}
void FModuleDescriptor::WriteArray(TJsonWriter<>& Writer, const TCHAR* Name, const TArray<FModuleDescriptor>& Modules)
{
	if(Modules.Num() > 0)
	{
		Writer.WriteArrayStart(Name);
		for(int Idx = 0; Idx < Modules.Num(); Idx++)
		{
			Modules[Idx].Write(Writer);
		}
		Writer.WriteArrayEnd();
	}
}
void FModuleDescriptor::Write(TJsonWriter<>& Writer) const
{
	Writer.WriteObjectStart();
	Writer.WriteValue(TEXT("Name"), Name.ToString());
	Writer.WriteValue(TEXT("Type"), FString(EHostType::ToString(Type)));
	Writer.WriteValue(TEXT("LoadingPhase"), FString(ELoadingPhase::ToString(LoadingPhase)));
	if (WhitelistPlatforms.Num() > 0)
	{
		Writer.WriteArrayStart(TEXT("WhitelistPlatforms"));
		for(int Idx = 0; Idx < WhitelistPlatforms.Num(); Idx++)
		{
			Writer.WriteValue(WhitelistPlatforms[Idx]);
		}
		Writer.WriteArrayEnd();
	}
	if (BlacklistPlatforms.Num() > 0)
	{
		Writer.WriteArrayStart(TEXT("BlacklistPlatforms"));
		for(int Idx = 0; Idx < BlacklistPlatforms.Num(); Idx++)
		{
			Writer.WriteValue(BlacklistPlatforms[Idx]);
		}
		Writer.WriteArrayEnd();
	}
	if (AdditionalDependencies.Num() > 0)
	{
		Writer.WriteArrayStart(TEXT("AdditionalDependencies"));
		for (int Idx = 0; Idx < AdditionalDependencies.Num(); Idx++)
		{
			Writer.WriteValue(AdditionalDependencies[Idx]);
		}
		Writer.WriteArrayEnd();
	}
	Writer.WriteObjectEnd();
}