FJsonSerializer::Deserialize only works with FFileHelper?

I’m getting a json string from an http response body and attempting to parse it. The deserializer fails unless I first write the json string to disk and read it back in. This seems crazy, but since all the examples I found online all read json from files then maybe its true? Or the write/read cycle does some cleanup that is not apparent in looking at the strings? See truncated code example:

void UBPFL::ReadJson(const FString inData) //inData is a json string
{
FString inDatacopy = “”;
FString tempfile = FPaths::ProjectSavedDir() + L"temp.json";

FFileHelper::SaveStringToFile(*inData, *tempfile); //write inData string passed in to disk
FFileHelper::LoadFileToString(inDatacopy, *tempfile); //reading the same file



 TSharedPtr<FJsonObject> JsonParsed = MakeShareable(new FJsonObject());
 TSharedRef<TJsonReader<TCHAR>> JsonReader = TJsonReaderFactory<TCHAR>::Create(inDatacopy); /**** see commentary **

if (FJsonSerializer::Deserialize(JsonReader, JsonParsed))
{ //do stuff with the JsonParsed object

**commentary: inDatacopy should be identical to inData, and appear so in the debugger, but if inData (or *inData ) is the argument in the ::Create(*inData ) then Deserialize FAILS. But reading the same data from disk into a temp variable works.
I suppose the JsonReader is initialized slightly different with these two different, but identical strings.
Although writing/reading is a workaround, it is resource intensive, time consuming, and overall ugly. Is there a trick here?

no, but I don’t know why

Can you try it like this

  FString Body = Response->GetContentAsString();
    
  TSharedPtr<FJsonObject> JsonObject;
  TSharedRef<TJsonReader<>> Reader = TJsonReaderFactory<>::Create(Body);
  if (FJsonSerializer::Deserialize(Reader, JsonObject))
  {
    //...
  }