Last active
March 2, 2018 17:09
-
-
Save TripleEh/dade6240750b5866d9becc79b43e6a6c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a root JSon object that'll hold all the sub sections | |
TSharedRef<FJsonObject> RootJson = MakeShareable(new FJsonObject); | |
// Output the contents of the DevNotes arrays | |
{ | |
for (int i = 0; i < m_aNoteContents.Num(); ++i) | |
{ | |
TSharedRef<FJsonObject> SubJson = MakeShareable(new FJsonObject); | |
SubJson->SetNumberField(TEXT("X"), m_aNotePositions[i].X); | |
SubJson->SetNumberField(TEXT("Y"), m_aNotePositions[i].Y); | |
SubJson->SetNumberField(TEXT("Z"), m_aNotePositions[i].Z); | |
SubJson->SetStringField(TEXT("Note"), *m_aNoteContents[i]); | |
RootJson->SetObjectField(FString::Printf(TEXT("Note_%d"), i), SubJson); | |
} | |
} | |
// Output the built string to file | |
{ | |
FString OutputStr; | |
TSharedRef<TJsonWriter<>> Writer = TJsonWriterFactory<>::Create(&OutputStr); | |
FJsonSerializer::Serialize(RootJson, Writer); | |
FString sFullPath = FPaths::ProjectSavedDir() + _sDevNotesFilename; | |
FFileHelper::SaveStringToFile(OutputStr, *sFullPath); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment