'how to map maltivalue json into a table in react

I am new to JSON and react development. So, I don't know the syntax of how to fetch this kind of JSON into the table or map into the table. I am using Fetch API and the method is GET

enter image description here



Solution 1:[1]

After fetching the JSON, set the hospitalAdmin to a State.

    // response is the JSON that you Fetched
    setAdmins(response.hospitalAdmin);

After that, you can just Map over the Array of Admins in the return/render of your Component, like so:

const AdminTable = () => {
    const [admins, setAdmins] = useState([]);
    
    // Code for Fetching Data

    return (
        <table>
            { admins.map((item) => (
              <tr>
                <td>{item.id}</td>
                ...
              </tr>
              )
            }
        </table>
    );
}

Solution 2:[2]

try it

 public async Task<string> HttpClientAsync(string url , string json, string token)
            {
                try
                {
                    var JsonData = new StringContent(json, Encoding.UTF8, "text/xml");
                    var handler = new HttpClientHandler();
                    handler.ClientCertificateOptions = ClientCertificateOption.Manual;
                    handler.ServerCertificateCustomValidationCallback =
                        (httpRequestMessage, cert, cetChain, policyErrors) =>
                        {
                            return true;
                        };
                    using (var client = new HttpClient(handler))
                    {
                        //  System.Net.ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
                        client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", token);
                        client.DefaultRequestHeaders.Add("SOAPAction", "");
                        var result = await client.PostAsync(url, JsonData);
                        string resultContent = await result.Content.ReadAsStringAsync();
                        return resultContent;
                    }
                }
                catch (Exception e)
                {
                    return e.Message;
                }
    
            }

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 mohammad asadi