AngularJS export filtered JSON data.

HTML

<div ng-app="myApp" ng-controller="MainCtrl">
    Search:<input ng-model="searchText">
    <div ng-repeat="test in tests | filter: searchText">
        {{test.key}} — {{test.value}}
    </div>
    <textarea ng-model="savedJSON"></textarea>
    <button ng-click="save()">Save</button>
</div>

JavaScript

var app = angular.module('myApp', []);

app.controller('MainCtrl', ['$scope', '$filter', function($scope, $filter) {
    var testJSON = '[{"key":"زهره","value":"Value0"},{"key":"Key1","value":"Value1"},{"key":"Key2","value":"Value2"},{"key":"Key3","value":"Value3"}]';
    
    $scope.tests = JSON.parse(testJSON);
    
    $scope.savedJSON = '';

    $scope.save = function() {
       $scope.savedJSON = angular.toJson($filter('filter')($scope.tests, $scope.searchText));
    };
}]);