<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Andrés Rossini</title>
    <description>The latest articles on DEV Community by Andrés Rossini (@tutinio1313).</description>
    <link>https://dev.to/tutinio1313</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F748981%2F82643a34-d6c0-4a99-802b-4e21cc5c92b1.jpeg</url>
      <title>DEV Community: Andrés Rossini</title>
      <link>https://dev.to/tutinio1313</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tutinio1313"/>
    <language>en</language>
    <item>
      <title>I don't know how to use an attribute of a JSON</title>
      <dc:creator>Andrés Rossini</dc:creator>
      <pubDate>Mon, 18 Apr 2022 18:18:27 +0000</pubDate>
      <link>https://dev.to/tutinio1313/i-dont-know-how-to-use-an-attribute-of-a-json-231a</link>
      <guid>https://dev.to/tutinio1313/i-dont-know-how-to-use-an-attribute-of-a-json-231a</guid>
      <description>&lt;p&gt;I was looking for access an JSON attribute in JavaScript, that come from an aspnet (so for that is the dotnet tag).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iIKYEvRe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uzqwljs8c9dl6wlsb2ht.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iIKYEvRe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uzqwljs8c9dl6wlsb2ht.jpg" alt="This is the JSON from the API" width="230" height="123"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The connection with js and aspnet is this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function PostAsociado()
{
    const sePuedeCargar = AsociadoCanPost(); 
    const AsociadoObject = SetAsociadoObject();
    var htmlState = document.getElementById('StateExecution');

    const response = fetch(urlAsociado,
        {
            method : 'POST',
            headers: 
            {
            'accept' : 'application/json',
            'Content-Type' : 'application/json',    
            },
            body : JSON.stringify(AsociadoObject) 
        })
        .then(response =&amp;gt; response.json())

        alert(response.executionSuccessful);

    if(response.executionSuccessful)
    {
        htmlState.innerHTML = "El asociado " +asociado.Nombre + " "+ asociado.Apellido  +" se ha cargado exitosamente.";
        htmlState.style.color = "green"; htmlState.style.display = "inherit"; 
    }
    else
    {
        htmlState.innerHTML = "El dni ya fue ingresado.";
        htmlState.style.color = "red"; htmlState.style.display = "inherit";
    }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the response class, the language used is C#, (each class have their own file, I just display in that way because is more easy to understand):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    public abstract class Response
    {
        public bool ExecutionSuccessful {get; set;}
        public string? ErrorMessage {get;set;}
    }

  public class AsociadoPostResponse: Response
    {
        public Asociado? asociado {get; set;}
    }


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>javascript</category>
      <category>json</category>
      <category>beginners</category>
      <category>dotnet</category>
    </item>
  </channel>
</rss>
