What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

If Angular shows [object Object] or an iterable error, first inspect the actual API response and the template expression consuming it. A TypeScript type on an HttpClient request does not validate the payload, and Angular’s DOM security sanitization will not turn an object into an array. Also verify the error code: Angular’s current error documentation identifies NG02200 as “Missing Iterable Differ,” but the current error index does not list NG02100. Don’t assume those codes mean the same thing.

What does Angular NG02100 mean?

The current Angular error index does not list NG02100, so the available official documentation does not establish what that code means or its version history. Angular does document NG02200: Missing Iterable Differ: a directive such as NgFor needs an iterable value, such as an array. If you see NG02100, check your Angular version, the complete console message, and the template or code location named in the error rather than silently treating it as NG02200.

  • Record the exact error code and full message.
  • Check the installed Angular version and compare its behavior with the documentation for that version.
  • Inspect the expression at the reported template line and determine what value it receives at runtime.

Why does Angular show [object Object]?

[object Object] is a common string representation of a JavaScript object. It can appear when an object is displayed where a string or list was expected, but the text alone does not identify the cause. The response may be an object containing an array, a plain object intended for key-value display, or a value parsed in a way the code did not expect.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Inspect the value at the service boundary, before it reaches the component. Check whether it is an array, an object with a nested array, a scalar, null, or text. Do not infer the runtime shape from a TypeScript interface or from what the endpoint is supposed to return.

How do I fix an Angular API response that is an object instead of an array?

Match the value passed to the template with what the template needs. For a list loop, provide the actual array—often a property nested inside the response object. If the interface should accept several response shapes, validate and normalize them into one stable array before binding.

this.http.get<unknown>('/api/items').subscribe(response => {
  // Inspect and validate response before assigning a list to the component.
});

Using unknown makes the need to narrow an uncertain value explicit. Validate the shape and required fields in application code before treating it as a particular model. The generic in HttpClient is a compile-time type assertion; Angular does not check that the server actually returned that type at runtime. See Angular’s Making requests guide.

When the response contains a nested array

Choose the array property rather than passing the containing object to the loop. For example, if the response is shaped like {"items":[...]}, bind the validated items collection, not the whole response. Confirm the property name and value from the actual response; do not assume this example matches your endpoint.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When the goal is to display an object’s keys and values

If the value is intentionally an object and the UI should show its entries, Angular’s KeyValue pipe is the documented option for iterating an object’s keys. A plain object is not interchangeable with an array for an iterable loop.

Does sanitize API response fix [object Object]?

No. API validation and Angular DOM security sanitization solve different problems. Validation checks the response’s structure and data before application code uses it; DOM sanitization applies security handling when values are bound into particular DOM contexts. Sanitization does not verify an API schema, select a nested array, or convert an object into an iterable.

Angular’s security guidance describes context-aware sanitization and trust-bypass APIs. Do not use a trust-bypass API to make an unexpected value render: bypassing security does not correct the data shape and can expose users to security risks if the value is untrusted.

Is the API response format wrong? Check HttpClient responseType

HttpClient assumes JSON by default. If the endpoint returns plain text or binary data, configure responseType to match the wire format instead of treating the result as JSON. Angular documents json, text, blob, and arraybuffer; the resulting type also depends on options such as observe. See the request guide and the HttpClient API reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a literal response-type option so TypeScript can select the corresponding overload:

this.http.get('/api/status', { responseType: 'text' });

Choose text only when the server returns text; use the appropriate binary option for binary data. Changing responseType is not a way to repair a JSON object whose structure does not match the component’s expectation.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How can I distinguish an HTTP failure from a bad response shape?

An HTTP request failure and a successful response with an unexpected body are separate problems. Angular sends request failures through the Observable error channel as HttpErrorResponse. Network or timeout problems and backend responses have their own status and error details. By contrast, the server may return successfully while the application receives a body whose shape does not fit the template.

  • If the Observable emits an error, inspect the HttpErrorResponse, including its status and error details, and diagnose the network, timeout, or backend failure.
  • If the request succeeds, inspect the emitted body’s runtime type and nesting, then validate, normalize, or select the value the component expects.

Angular’s HTTP request guide explains response handling and request errors.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.