0

I want to print JSON file in HTML page but I don't know the keys and the values my JSON Object.

When I know the form of JSON I use this code:

<div ng-repeat="f in faq">
  <div class="list-group-item clearfix">
    <h4>
      <span class="glyphicon glyphicon-file">
        </span>
          {{f.key}}-{{f.value}}
            <span class="pull-right">
              <button class="btn btn-warning" ng-click="">
                <span class="glyphicon glyphicon-trash">
          </span>
    </button>
    </span>
  </h4>
  </div>
 </div>  
</div>

But in this moment I don't know the keys and the values of the JSON.

Thanks for your help.

2
  • Are you using some sort of framework to render the {{ }} templates? Commented Aug 6, 2016 at 17:38
  • @Soviut it should be AngularJS. Commented Aug 6, 2016 at 21:09

1 Answer 1

2

Looks like you are using angular(I noticed from ng-repeat). You can use (key,data) as follows:-

<div ng-repeat="(key, data) in faq">
  {{key}} - {{data}}
</div>
Sign up to request clarification or add additional context in comments.

2 Comments

can u please accept the answer if u feel its correct?
Any clue how ti use in Angular2 with ngFor

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.