How can I read JSON data in a variable with type of `types.Dynamic`?

I am writing a Custom Terraform Provider for Ansible Forms using the Terraform plugin framework (GitHub – hashicorp/terraform-plugin-framework: A next-generation framework for building Terraform providers. v1.8.0). How can I read JSON string in a field with type types.Dynamic? The JSON string itself contains a map where values types are different.

Here is my DS model:

type JobDataSourceModel struct {
    CxProfileName types.String  `tfsdk:"cx_profile_name"`
    ...
    Extravars     types.Dynamic `tfsdk:"extravars"`
    ...
}

Here is the Schema() method:

func (d *JobDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
    resp.Schema = schema.Schema{
        Attributes: map[string]schema.Attribute{
            ...
            "extravars": schema.DynamicAttribute{
                MarkdownDescription: "",
                Computed:            true,
            },
            ...
        },
    }
}

The Read() method:

func (d *JobDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
    var data JobDataSourceModel
    ...
    data.Extravars = types.DynamicValue(restInfo.Data.Extravars)
    ...
}

Data returned by the Ansible Forms API is given below. The extravars field is a JSON string in the API response. I am converting a value of extravars into a map. Map values has diff types such as list, str, and boolean. That’s why I want to use types.Dynamic.

{
    "status": "success",
    "message": "job ran successfully",
    "data": {
        "id": 86,
        "form": "Demo Form Ansible No input",
        "target": "Demo Form Ansible No input",
        "status": "success",
        "start": "2024-05-02T15:35:16.000Z",
        "end": "2024-05-02T15:35:18.000Z",
        "user": "admin",
        "user_type": "local",
        "job_type": "ansible",
        "extravars": "{"name":"vm1","region":"myregion","opco":"myopco","svm_name":"mysvm_name","exposure":"myexposure","env":"myenv","dataclass":"mydataclass","share_name":"myshare_name","accountid":"myaccountid","size":"mysize","protection_required":"myprotection_required","ansibleforms_user":{"username":"admin","id":1,"type":"local","groups":["local/admins"],"roles":["public","admin"]},"__playbook__":"dummy.yaml","__inventory__":"","__credentials__":{"vcenterCredentials":"VCENTER"}}",
        "credentials": "{"vcenterCredentials":"VCENTER"}",
        "notifications": "{}",
        "approval": null,
        "step": null,
        "parent_id": null,
        "subjobs": null,
        "no_of_records": 45,
        "counter": 8,
        "output": "<span class='has-text-warning'>[WARNING]: No inventory was parsed, only implicit localhost is available</span> <span class='tag is-info is-light'>2024-05-02 15:35:17</span>rn<span class='has-text-warning'>[WARNING]: provided hosts list is empty, only localhost is available. Note that</span> <span class='tag is-info is-light'>2024-05-02 15:35:17</span>rn<span class='has-text-warning'>the implicit localhost does not match 'all'</span>rn<span class='has-text-warning'>[WARNING]: Found variable using reserved name: name</span> <span class='tag is-info is-light'>2024-05-02 15:35:17</span>rnn<span class='has-text-weight-bold'>PLAY [This is a hello-world example] *******************************************</span> <span class='tag is-info is-light'>2024-05-02 15:35:17</span>rnrn<span class='has-text-weight-bold'>TASK [Gathering Facts] *********************************************************</span>rn<span class='has-text-success'>ok: [localhost]</span> <span class='tag is-info is-light'>2024-05-02 15:35:18</span>rnrn<span class='has-text-weight-bold'>TASK [Output 'Welcome'.] *******************************************************</span>rn<span class='has-text-success'>ok: [localhost] => </span> <span class='tag is-info is-light'>2024-05-02 15:35:18</span>rn<span class='has-text-success'>  msg: Hi there and welcome to ansible</span>rnrn<span class='has-text-weight-bold'>PLAY RECAP *********************************************************************</span>rn<span class=''>localhost                  : <span class='tag is-success'>ok=2</span>    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0</span>rn<span class='has-text-success'>ok: [Playbook finished] with status (0)</span> <span class='tag is-info is-light'>2024-05-02 15:35:18</span>"
    }
}

I’ve tried doing that with the code abov, but it does not work.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật