1

Data like this:

Print like this

enter image description here

Data like in image

enter image description here

1
  • I can,t able to put data in json format so i put image please don't mind Commented Sep 12, 2018 at 9:03

2 Answers 2

1

If printing the object like

console.log(obj);

doesn't help, JSON.stringify is the method you are looking for:

console.log(JSON.stringify(obj));
Sign up to request clarification or add additional context in comments.

2 Comments

I want to print on UI not in log
like using for loop but don't understand how to access using for loop
1

From your comment in one answer:

I want to print on UI not in log

I assume you want to print on the web browser view instead?

In your html template you can do this:

   <pre>{{ obj | json }}</pre>

(The <pre> tag preserves the spaces and prints object values neatly as in with hierarchy)

That will display the obj in the following format in the browser:

enter image description here

Source

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.