Tutorial

This page shows a quick demo of how to use DcJsonAsset.

  1. First ensure that the plugin is properly integrated in your project. Open Settings -> Plugins and search for DataConfig JSON Asset:

    DataConfig JsonAsset Plugin

  2. We have bundled a simple Blueprint class DcTestBPDataAsset:

    DcTestBPDataAsset

    It's almost equivalent to a C++ UCLASS like this:

    UCLASS()
    class UDcTestBPDataAsset : public UDcPrimaryImportedDataAsset {
    GENERATED_BODY()
    public:
        UPROPERTY(EditAnywhere) FString StrField;
        UPROPERTY(EditAnywhere) int IntField;
        UPROPERTY(EditAnywhere) FName NameField;
    };
    
  3. Prepare a JSON file on disk with the content below:

    {
        "$type" : "/DcJsonAsset/DcFixture/DcTestBPDataAsset",
        "StrField" : "Hello DataConfig Json Asset",
        "IntField" : 43,
    }
    
  4. Then drop the file from the explorer into "Content Browser" and it's done.

    ImportExampleJson

  5. Say we made a mistake when editing the JSON file:

    {
        "$type" : "/DcJsonAsset/DcFixture/DcTestBPDataAsset",
        "StrField" : "Hello DataConfig Json Asset",
        "IntField" : 43,
        "NoField" : "Does not exist", // <- field doesn't exist in class
    }
    

    Right click on the Example asset and select reimport. DcJsonAsset would report this error in the "Message Log" window:

    MessageLogDiagnostics