JSFiddle - React, Tailwind, and code Playground

HTML

<div id="settingsholder" ng-controller="MyCtrl">
      <input ng-model="user.firstName" />
      <input ng-model="user.lastName" />
      <input type="button" ng-click="showJson()" value="Object To JSON" />
        <hr/>  
        {{user | json}}<br><br>
        JSON: {{json}}
    </div>

JavaScript

function MyCtrl($scope) {

    $scope.user = {firstName:"",lastName:"" };
    
    $scope.showJson = function() {
        $scope.json = angular.toJson($scope.user);
    }
    
    $scope.init = function() {
        $scope.json = angular.toJson($scope.user);
    }
    
    $scope.init();
}