title: How to get value of Java Map in Typescript
body: <p>I am using Spring boot as backend and Angular 7 as frontend in an application. I have to send map as response. For instance, say:</p>
  <pre><code>  Map&lt;String, Object&gt; additionalResponse = new HashMap&lt;&gt;() {
          {
              put(&quot;key1&quot;,&quot;value2&quot;);
              put(&quot;key2&quot;,&quot;value2&quot;);
             
          }
      };
  </code></pre>
  <p>I pass this map via response DTO to angular which is:</p>
  <pre><code>public class SearchResponseDto implements Serializable {
  private Map&lt;String, Object&gt; additionalResponse;
  }
  </code></pre>
  <p>Now on angular, I am using it as:</p>
  <pre><code> export class SearchResponseDto {
       additionalResponse: Map&lt;string, any&gt;;
     }
  </code></pre>
  <p>I can get value from <strong>additionalResponse</strong> but when I try to use get function in additionalResponse, it is giving me <strong>undefined</strong> value. What should I do to use <strong>additionalResponse</strong> as Map on angular?</p>
  <p>Edit:
  I am using the backend response in Angular as:</p>
  <pre><code>      fetchData() {
          fetchResponse().
             .subscribe(
                response =&gt; {
       
                  this.response = response;
            
              },
             errorResponse =&gt; {
         
            },
         );
        }
  
  
  
   fetchResponse(): Observable&lt;SearchResponseDto&gt; {
              return this.http.post&lt;SearchResponseDto&gt;(
                &lt;api-endpoints&gt;
              );
            }
  </code></pre>
  <p>And, trying to use as <strong>this.response.additionalResponse.get('key1')</strong> and I am getting value as <strong>undefined</strong> but I am getting value from <strong>this.response.additionalResponse</strong></p>
  <p>On Postman, I am getting response as:</p>
  <pre><code>{
    &quot;additionalResponse&quot;: {
      &quot;key1&quot;: &quot;value2&quot;,
      &quot;key2&quot;: &quot;value2&quot;
    }
  }
  </code></pre>