x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

StaticStruct:Identifier not found

Hello! I'm having trouble passing in a value to a function in UE4. Here I have this bit of code within my CPP:

 FJsonObjectConverter::JsonObjectStringToUStruct(g, FEncodedString::StaticStruct(), 0, 0);

Whilst here in my MyActor.h I have this USTRUCT:

 // Fill out your copyright notice in the Description page of Project Settings.
 
 #pragma once
 
 #include "CoreMinimal.h"
 #include "GameFramework/Actor.h"
 #include "Runtime/Online/HTTP/Public/Http.h"
 #include "Runtime/Json/Public/Dom/JsonObject.h"
 #include "Runtime/Json/Public/Serialization/JsonSerializer.h"
 #include "Runtime/Core/Public/Misc/Base64.h"
 #include "Runtime/JsonUtilities/Public/JsonObjectWrapper.h"
 #include "Runtime/JsonUtilities/Public/JsonObjectConverter.h"
 #include "MyActor.generated.h"
 
 //If you want this to appear in BP, make sure to use this instead
 //USTRUCT(BlueprintType)
 
 USTRUCT(BlueprintType)
 struct FEncodedString
 {
     GENERATED_USTRUCT_BODY()
 
     UPROPERTY(BlueprintReadWrite, Category = "Common")
     FString encoded;
 
 
     FString str()
     {
         return encoded;
     }
 
     FEncodedString()
     {
         encoded = "";
     }
 };
 



When building and running the code, it spits out the errors: "StaticStruct:Identifier not Found" and "StaticStruct': is not a member of 'UScriptStruct"

This is a question concerning, both, proper UStructDeclaration, and if it has anything to do with these errors. Also if not, what is the cause. Is there a way to declare a StaticStruct within my Struct. Are there examples?

Any help would be greatly appreciated! And assuming anyone has any insight on this, please try and help this person who also seems to be in a similar situation: https://answers.unrealengine.com/questions/660240/jsonobjectstringtostruct-problem.html

Thank you!

Product Version: UE 4.18
Tags:
more ▼

asked Feb 05 '18 at 07:30 PM in C++ Programming

avatar image

Donut5
13 2 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

You need to create an actual variable of type FEncodedString so you can save this parsed json data

 FEncodedString MyObject;
 FJsonObjectConverter::JsonObjectStringToUStruct(g, &MyObject, 0, 0);
 
 // MyObject will now contain the parsed json data that was stored in the string g

Here's an engine example: Link

more ▼

answered Feb 06 '18 at 11:30 AM

avatar image

Ali Akbar
686 2 5 8

avatar image Donut5 Feb 07 '18 at 09:28 PM

Thank you! The link is broken, though. :'(

avatar image Ali Akbar Feb 08 '18 at 02:53 PM

You need to be logged in to GitHub and have UE code linked to your account for it to work :) The above code example should be enough though

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question