├── .gitignore ├── .styleci.yml ├── .travis.yml ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── composer.json ├── phpunit.xml ├── src └── JsonCollect.php └── tests ├── JsonCollectTest.php └── json.txt /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | vendor 3 | composer.lock 4 | .idea 5 | .DS_Store 6 | -------------------------------------------------------------------------------- /.styleci.yml: -------------------------------------------------------------------------------- 1 | preset: laravel 2 | 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | php: 4 | - 7.0 5 | - 7.1 6 | - 7.2 7 | 8 | before_script: 9 | - composer self-update 10 | - composer install 11 | 12 | script: phpunit -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribute to JsonCollect! 2 | 3 | Thanks for your interest in contributing! I always appreciate the help and will be certain to give credit when merged. Contributions are only accepted via pull requests on [Github](https://github.com/jshannon63/jsoncollect). 4 | 5 | 6 | ## Always Open an Issue 7 | 8 | If you have an idea for a feature, you can potentially save yourself if time you first open an issue before writing code. I promise to review your ideas quickly to determine if it is appropriate for the community as a whole. 9 | 10 | ## Please Follow Some Basic Standards 11 | 12 | - Please follow the **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** 13 | - Update the `README.md` whenever there are any changes in package behaviour. 14 | - Clearly name your commits, and be sure to squash before submitting. -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | Copyright (c) Jim Shannon [https://jimshannon.me](https://jimshannon.me) 4 | 5 | > Permission is hereby granted, free of charge, to any person obtaining a copy 6 | > of this software and associated documentation files (the "Software"), to deal 7 | > in the Software without restriction, including without limitation the rights 8 | > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | > copies of the Software, and to permit persons to whom the Software is 10 | > furnished to do so, subject to the following conditions: 11 | > 12 | > The above copyright notice and this permission notice shall be included in 13 | > all copies or substantial portions of the Software. 14 | > 15 | > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | > THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/jshannon63/jsoncollect.svg?branch=master)](https://travis-ci.org/jshannon63/jsoncollect) 2 | [![StyleCI](https://styleci.io/repos/113889574/shield?branch=master)](https://styleci.io/repos/113889574) 3 | [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md) 4 | 5 | 6 | # Supercharge your JSON using collections in PHP 7 | 8 | The JsonCollect package allows you to surround your JSON objects with the power of collection methods. Making it easy to traverse your data with methods like each(), pluck(), where(), tap(), reduce(), search(), filter(), map(), transform() and many others. 9 | 10 | __Framework Agnostic.__ 11 | 12 | __100% PHPUnit Test Coverage.__ 13 | 14 | __Heavily dependent on [tightenco/collect](https://github.com/tightenco/collect), [Matt Stauffer's](https://twitter.com/stauffermatt) split of Laravel's Illuminate Collections.__ 15 | 16 | See the Laravel documentation [here](https://laravel.com/docs/5.5/collections#available-methods) for more on available methods and usage. 17 | 18 | Additionally, this package provides customized getters and setters for accessing keyed data elements. Described in more detail below. 19 | ## Installation 20 | ``` 21 | composer require jshannon63/jsoncollect 22 | ``` 23 | if installing in the Laravel framework, JsonCollect will depend on the frameworks copy of Illuminate Collections and tightenco/collect will not be required. 24 | ## Usage 25 | 26 | Supply your data to the JsonCollect constructor. The form of your 27 | data can be a JSON String, a stdClass object or an Array. JsonCollect 28 | will recursively dive into the deepest depths of your JSON tree 29 | and convert everything to collections. 30 | ### Injecting your JSON 31 | ```php 32 | use Jshannon63\JsonCollect\JsonCollect; 33 | 34 | 35 | $collection = new JsonCollect($json); 36 | ``` 37 | Note: You can set the recursion depth of JsonCollect by supplying the optional second constructor argument $depth. Default value is 512. 38 | 39 | ### Working with your JSON collection 40 | 41 | JsonCollect provides custom getter and setter methods for your data. Simply call the methods "get" or "set" with the key name appended to the method name to access your data directly to retrieve or to create/update. 42 | 43 | ```php 44 | // to retrieve the element with the key "name" 45 | $collection->getname(); 46 | 47 | // will set the value of the element with the key "phone" 48 | $collection->setphone('123-456-7890'); 49 | ``` 50 | 51 | As mentioned earlier, you should visit the Laravel documentation [here](https://laravel.com/docs/5.5/collections#available-methods) 52 | for more on the *"~100 available methods"* and their usage. 53 | 54 | Some fun examples: 55 | ```php 56 | // send an email to all friends 57 | $collection->getfriends()->each(function ($item, $key) use ($mailer,$subject,$body){ 58 | $mailer->sendmail($item->emailaddress,$subject,$body); 59 | }); 60 | 61 | // total all your invoices 62 | $total = $collection->getinvoices()->pluck('total')->sum(); 63 | 64 | // update the sales tax rate for all Kentucky stores 65 | $collection->getstores()->where('state','KY')->transform(function ($item, $key) use ($rate) { 66 | return $item->settaxrate($rate); 67 | }); 68 | ``` 69 | 70 | ### Starting from scratch with an empty JsonCollect object 71 | It is not necessary to provide data to JsonCollect if your goal is to build a new collection of JSON data. Simply "new up" an instance of JsonCollect and begin adding data. Notice how we use ArrayAccess to simplify our code, and to show flexibility we used the custom getter to retrieve the address collection for setting the city. 72 | ```php 73 | $collection = new JsonCollect(); 74 | 75 | $collection['names'] = 'John Doe'; 76 | 77 | // or if you have multi-level data, you may add another JsonCollect 78 | 79 | $collection['address'] = new JsonCollect(); 80 | $collection['address']->setstreet('123 Fourth Street'); 81 | $collection->getaddress()->setcity('Louisville'); 82 | $collection['address']->setstate('KY'); 83 | $collection['address']->setzip('40201'); 84 | 85 | // and we can use the collection method dd() to view the contents... 86 | 87 | $collection->dd(); 88 | ``` 89 | Which generates the following output from the die-and-dump. 90 | ```bash 91 | array(2) { 92 | 'names' => 93 | string(8) "John Doe" 94 | 'address' => 95 | class Jshannon63\JsonCollect\JsonCollect#327 (1) { 96 | protected $items => 97 | array(4) { 98 | 'street' => 99 | string(6) "123 Fourth Street" 100 | 'city' => 101 | string(4) "Louisville" 102 | 'state' => 103 | string(5) "KY" 104 | 'zip' => 105 | string(3) "40201" 106 | } 107 | } 108 | } 109 | ``` 110 | ### Exporting your JSON when needed 111 | The following export() method will return a complete JSON string representation 112 | of your collection's data. Note that export will accept the standard json_encode options. 113 | ```php 114 | $json = $collection->export(JSON_PRETTY_PRINT); 115 | ``` 116 | Based on the previous example, this is what we would expect to see from our export. 117 | ```json 118 | { 119 | "names": "John Doe", 120 | "address": { 121 | "street": "123 Fourth Street", 122 | "city": "Louisville", 123 | "state": "KY", 124 | "zip": "40201" 125 | } 126 | } 127 | ``` 128 | ## Contributing 129 | 130 | If you would like to contribute refer to CONTRIBUTING.md -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jshannon63/jsoncollect", 3 | "type": "library", 4 | "description": "Supercharge your JSON using collections", 5 | "keywords": [ 6 | "collection", 7 | "json", 8 | "php", 9 | "laravel" 10 | ], 11 | "homepage": "https://github.com/jshannon63/jsoncollect", 12 | "license": "MIT", 13 | "authors": [ 14 | { 15 | "name": "Jim Shannon", 16 | "email": "jim@hltky.com", 17 | "homepage": "https://jimshannon.me/" 18 | } 19 | ], 20 | "require": { 21 | "php": ">=7.0.0", 22 | "tightenco/collect": "^5.5" 23 | }, 24 | "require-dev": { 25 | "phpunit/phpunit": "~6.0" 26 | }, 27 | "autoload": { 28 | "psr-4": { 29 | "Jshannon63\\JsonCollect\\": "src/" 30 | } 31 | }, 32 | "minimum-stability": "dev" 33 | } 34 | 35 | 36 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | ./tests 14 | 15 | 16 | 17 | 18 | ./src 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/JsonCollect.php: -------------------------------------------------------------------------------- 1 | parseItems($items, $depth)); 13 | 14 | $this->resolve($this); 15 | } 16 | 17 | private function parseItems($items, $depth) 18 | { 19 | if (is_object($items)) { 20 | if (get_class($items) != stdClass::class) { 21 | throw new \InvalidArgumentException('Invalid object type ('.get_class($items).') provided.'); 22 | } 23 | } elseif (is_string($items)) { 24 | $items = json_decode($items, false, $depth); 25 | if ($err = $this->getLastJsonError()) { 26 | throw new \InvalidArgumentException('Provided string cannot be evaluated as JSON: '.$err); 27 | } 28 | } 29 | 30 | return $items; 31 | } 32 | 33 | private function resolve(Collection $collection) 34 | { 35 | $this->items = $collection->each(function ($item, $key) { 36 | if (is_array($item)) { 37 | $this->put($key, new JsonCollect($item)); 38 | } elseif (is_object($item)) { 39 | if (get_class($item) == stdClass::class) { 40 | $this->put($key, new JsonCollect($item)); 41 | } 42 | } 43 | })->all(); 44 | } 45 | 46 | public function export($options = 0) 47 | { 48 | return $this->toJson($options); 49 | } 50 | 51 | private function getLastJsonError() 52 | { 53 | $errors = [ 54 | JSON_ERROR_NONE => null, 55 | JSON_ERROR_DEPTH => 'Maximum stack depth exceeded', 56 | JSON_ERROR_STATE_MISMATCH => 'Underflow or the modes mismatch', 57 | JSON_ERROR_CTRL_CHAR => 'Unexpected control character found', 58 | JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON', 59 | JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded', 60 | ]; 61 | 62 | return $errors[json_last_error()]; 63 | } 64 | 65 | public function __call($method, $parameters) 66 | { 67 | if (substr($method, 0, 3) == 'get' && strlen($method) > 3) { 68 | $key = substr($method, 3); 69 | 70 | return $this->get($key); 71 | } elseif (substr($method, 0, 3) == 'set' && strlen($method) > 3) { 72 | $key = substr($method, 3); 73 | $this->put($key, $parameters[0]); 74 | } else { 75 | throw new \BadMethodCallException(get_class($this).' is not aware of the method: '.$method.'.'); 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /tests/JsonCollectTest.php: -------------------------------------------------------------------------------- 1 | string_example = $string; 24 | $this->basic_example = json_decode($string); 25 | 26 | $string = '{"foo":"bar","baz":"zaz","fiz":{"pop":"pow"},"abc":{"xyz":"456","cba":"321"}}'; 27 | $this->multi_example = json_decode($string); 28 | 29 | $string = file_get_contents('./tests/json.txt'); 30 | $this->big_example = json_decode($string); 31 | } 32 | 33 | public function testConstructor() 34 | { 35 | // newing up without value works or (null) 36 | $test = new JsonCollect; 37 | $this->assertInstanceOf(JsonCollect::class, $test); 38 | 39 | // newing up without value works or (null) 40 | $test = new JsonCollect($this->string_example); 41 | $this->assertInstanceOf(JsonCollect::class, $test); 42 | 43 | // newing up with stdClass works 44 | $this->assertInstanceOf(stdClass::class, $this->basic_example); 45 | $test = new JsonCollect($this->basic_example); 46 | $this->assertEquals(2, $test->count()); 47 | 48 | // newing up with json string works 49 | $test = new JsonCollect('{"foo": "bar", "baz": "zaz"}'); 50 | $this->assertEquals(2, $test->count()); 51 | } 52 | 53 | public function testBadJsonStringFails() 54 | { 55 | // newing up with bad string fails 56 | $this->expectException(\InvalidArgumentException::class); 57 | new JsonCollect('this is a bad string'); 58 | } 59 | 60 | public function testInvalidObjectInConstructorFails() 61 | { 62 | //newing up with invalid object fails 63 | $this->expectException(\InvalidArgumentException::class); 64 | new JsonCollect(new foo); 65 | } 66 | 67 | public function testCallMethods() 68 | { 69 | // verify Get __call methods works 70 | $test = new JsonCollect($this->basic_example); 71 | $this->assertEquals('bar', $test->getfoo()); 72 | $this->assertEquals('zaz', $test->getbaz()); 73 | 74 | // verify Set __call method works 75 | $test->setfoo('yaz'); 76 | $test->setbaz('fiz'); 77 | $this->assertEquals('yaz', $test->getfoo()); 78 | $this->assertEquals('fiz', $test->getbaz()); 79 | 80 | $this->assertEquals('foo', $test->search('yaz')); 81 | } 82 | 83 | public function testBadMethodCall() 84 | { 85 | // verify bad method exception is thrown on unknown method 86 | $test = new JsonCollect($this->basic_example); 87 | $this->expectException(\BadMethodCallException::class); 88 | $test->badmethodfoo(); 89 | } 90 | 91 | public function testMultiLevel() 92 | { 93 | $test = new JsonCollect($this->multi_example); 94 | 95 | $this->assertEquals('456', $test->getabc()->getxyz()); 96 | } 97 | 98 | public function testBigJson() 99 | { 100 | $test = new JsonCollect($this->big_example); 101 | 102 | $this->assertEquals('Denise Clemons', $test->first()->getfriends()->last()->getname()); 103 | } 104 | 105 | public function testExports() 106 | { 107 | $test = new JsonCollect($this->basic_example); 108 | $this->assertEquals(json_encode($this->basic_example), $test->export()); 109 | 110 | $test = new JsonCollect($this->multi_example); 111 | $this->assertEquals(json_encode($this->multi_example), $test->export()); 112 | 113 | $test = new JsonCollect($this->big_example); 114 | $this->assertEquals(json_encode($this->big_example), $test->export()); 115 | } 116 | 117 | public function testReadmeExample() 118 | { 119 | $expectedresult = '{"names":"John Doe","address":{"street":"123 Fourth Street","city":"Louisville","state":"KY","zip":"40201"}}'; 120 | 121 | $collection = new JsonCollect(); 122 | 123 | $collection['names'] = 'John Doe'; 124 | 125 | $collection['address'] = new JsonCollect(); 126 | $collection['address']->setstreet('123 Fourth Street'); 127 | $collection->getaddress()->setcity('Louisville'); 128 | $collection['address']->setstate('KY'); 129 | $collection['address']->setzip('40201'); 130 | 131 | $this->assertContains($expectedresult, $collection->export()); 132 | } 133 | 134 | public function testEmptyExport() 135 | { 136 | $collection = new JsonCollect(); 137 | 138 | $this->assertEquals('[]', $collection->export()); 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /tests/json.txt: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "_id": "5a2e95274059f969a3a7cdb5", 4 | "index": 0, 5 | "guid": "421e3da6-0a13-4617-ac9c-c9c6f28be973", 6 | "isActive": false, 7 | "balance": "$1,798.79", 8 | "picture": "http://placehold.it/32x32", 9 | "age": 35, 10 | "eyeColor": "brown", 11 | "name": "Betsy Rodgers", 12 | "gender": "female", 13 | "company": "IDETICA", 14 | "email": "betsyrodgers@idetica.com", 15 | "phone": "+1 (923) 499-3746", 16 | "address": "554 Ridgecrest Terrace, Brewster, Marshall Islands, 7331", 17 | "about": "Et id velit aliqua fugiat commodo irure commodo sunt cillum dolore consequat ipsum. Do in eu in culpa deserunt proident velit. Sint ipsum dolor id adipisicing fugiat non sint aute eu veniam voluptate do.\r\n", 18 | "registered": "2015-12-21T02:35:31 +05:00", 19 | "latitude": 7.981819, 20 | "longitude": -176.790751, 21 | "tags": [ 22 | "anim", 23 | "pariatur", 24 | "consequat", 25 | "cupidatat", 26 | "sit", 27 | "qui", 28 | "adipisicing" 29 | ], 30 | "friends": [ 31 | { 32 | "id": 0, 33 | "name": "Ines Love" 34 | }, 35 | { 36 | "id": 1, 37 | "name": "Spence Bean" 38 | }, 39 | { 40 | "id": 2, 41 | "name": "Denise Clemons" 42 | } 43 | ], 44 | "greeting": "Hello, Betsy Rodgers! You have 7 unread messages.", 45 | "favoriteFruit": "banana" 46 | }, 47 | { 48 | "_id": "5a2e95275fe93bbe54d94cd7", 49 | "index": 1, 50 | "guid": "421a6f37-df7e-405b-9a53-b7ea50578566", 51 | "isActive": false, 52 | "balance": "$1,497.46", 53 | "picture": "http://placehold.it/32x32", 54 | "age": 36, 55 | "eyeColor": "blue", 56 | "name": "Mandy Raymond", 57 | "gender": "female", 58 | "company": "FLOTONIC", 59 | "email": "mandyraymond@flotonic.com", 60 | "phone": "+1 (969) 557-3352", 61 | "address": "292 Downing Street, Bancroft, Hawaii, 1769", 62 | "about": "Est exercitation ut reprehenderit eu proident fugiat. In laborum adipisicing ut ea occaecat ea sunt deserunt sit duis occaecat incididunt. Veniam ex laborum labore labore duis velit pariatur sunt ullamco laborum reprehenderit amet est. Nisi eu sit velit voluptate cupidatat ut. Exercitation ipsum velit qui quis nulla aliquip exercitation dolor est nostrud commodo officia. Fugiat id sint id officia dolore tempor sunt fugiat.\r\n", 63 | "registered": "2016-07-01T08:55:32 +04:00", 64 | "latitude": -16.728466, 65 | "longitude": -139.957345, 66 | "tags": [ 67 | "velit", 68 | "occaecat", 69 | "eu", 70 | "laboris", 71 | "sit", 72 | "exercitation", 73 | "ullamco" 74 | ], 75 | "friends": [ 76 | { 77 | "id": 0, 78 | "name": "Molina Cooley" 79 | }, 80 | { 81 | "id": 1, 82 | "name": "Davis Henderson" 83 | }, 84 | { 85 | "id": 2, 86 | "name": "Lindsey Sweeney" 87 | } 88 | ], 89 | "greeting": "Hello, Mandy Raymond! You have 8 unread messages.", 90 | "favoriteFruit": "apple" 91 | }, 92 | { 93 | "_id": "5a2e952722b8021dbf9955e2", 94 | "index": 2, 95 | "guid": "a15d6554-d83c-42d5-9726-1f2bf2565a2a", 96 | "isActive": true, 97 | "balance": "$3,061.37", 98 | "picture": "http://placehold.it/32x32", 99 | "age": 26, 100 | "eyeColor": "green", 101 | "name": "Carson Richards", 102 | "gender": "male", 103 | "company": "TROLLERY", 104 | "email": "carsonrichards@trollery.com", 105 | "phone": "+1 (936) 554-2588", 106 | "address": "939 Strauss Street, Chapin, Puerto Rico, 4648", 107 | "about": "Nostrud fugiat amet consectetur ad minim. Cillum esse elit eu voluptate ullamco in commodo. Ad velit non exercitation quis pariatur et nisi culpa ex aliquip adipisicing adipisicing. Sit aliqua voluptate culpa enim ex sit ex non nulla eiusmod ullamco. Occaecat sit et culpa fugiat nulla esse pariatur amet officia velit ipsum laborum.\r\n", 108 | "registered": "2016-06-09T01:57:07 +04:00", 109 | "latitude": -21.504887, 110 | "longitude": 150.805898, 111 | "tags": [ 112 | "cillum", 113 | "enim", 114 | "nulla", 115 | "excepteur", 116 | "quis", 117 | "dolore", 118 | "laborum" 119 | ], 120 | "friends": [ 121 | { 122 | "id": 0, 123 | "name": "Mercer Matthews" 124 | }, 125 | { 126 | "id": 1, 127 | "name": "Gordon Singleton" 128 | }, 129 | { 130 | "id": 2, 131 | "name": "Clark Bridges" 132 | } 133 | ], 134 | "greeting": "Hello, Carson Richards! You have 1 unread messages.", 135 | "favoriteFruit": "banana" 136 | }, 137 | { 138 | "_id": "5a2e95274266a147f976f1ef", 139 | "index": 3, 140 | "guid": "27dd5e1c-bb90-495d-a691-fc8d0fb069d0", 141 | "isActive": true, 142 | "balance": "$3,008.39", 143 | "picture": "http://placehold.it/32x32", 144 | "age": 30, 145 | "eyeColor": "green", 146 | "name": "Boyer Woodward", 147 | "gender": "male", 148 | "company": "PYRAMIA", 149 | "email": "boyerwoodward@pyramia.com", 150 | "phone": "+1 (810) 490-3741", 151 | "address": "921 Bridgewater Street, Garfield, Mississippi, 4365", 152 | "about": "Est aute enim proident qui amet voluptate sit et eiusmod anim excepteur velit. Commodo mollit labore consectetur sit consequat reprehenderit dolore dolore exercitation. Laborum dolor reprehenderit do enim ipsum in ipsum duis consectetur adipisicing sit minim irure. Nulla voluptate sunt dolore excepteur cillum exercitation minim anim sint dolore laborum minim exercitation minim. Aliquip ut exercitation in laboris proident deserunt proident id exercitation voluptate. Aliquip non nostrud exercitation aliqua commodo irure cillum veniam occaecat voluptate enim nisi reprehenderit tempor.\r\n", 153 | "registered": "2016-01-08T07:37:56 +05:00", 154 | "latitude": -56.469072, 155 | "longitude": 143.424573, 156 | "tags": [ 157 | "qui", 158 | "duis", 159 | "esse", 160 | "non", 161 | "eiusmod", 162 | "dolore", 163 | "irure" 164 | ], 165 | "friends": [ 166 | { 167 | "id": 0, 168 | "name": "Kaitlin Mcdaniel" 169 | }, 170 | { 171 | "id": 1, 172 | "name": "Ballard Strickland" 173 | }, 174 | { 175 | "id": 2, 176 | "name": "Gibson Schroeder" 177 | } 178 | ], 179 | "greeting": "Hello, Boyer Woodward! You have 2 unread messages.", 180 | "favoriteFruit": "apple" 181 | }, 182 | { 183 | "_id": "5a2e9527cf78b75bd72816f9", 184 | "index": 4, 185 | "guid": "d374576c-8627-43b0-93fd-3c32e5ba7833", 186 | "isActive": true, 187 | "balance": "$1,289.57", 188 | "picture": "http://placehold.it/32x32", 189 | "age": 40, 190 | "eyeColor": "green", 191 | "name": "Craig Mcleod", 192 | "gender": "male", 193 | "company": "OVATION", 194 | "email": "craigmcleod@ovation.com", 195 | "phone": "+1 (811) 509-3275", 196 | "address": "690 Kansas Place, Motley, Utah, 491", 197 | "about": "Qui do ad nostrud voluptate et ipsum. Dolor cillum cillum pariatur ut culpa et nisi quis. Dolor quis incididunt cillum aliquip labore in enim anim irure nostrud cillum velit. Proident veniam eu magna nostrud elit mollit officia. Incididunt ipsum adipisicing aute commodo minim anim veniam. Irure officia adipisicing veniam occaecat irure dolor labore velit fugiat ad. Deserunt aute culpa labore fugiat officia labore magna.\r\n", 198 | "registered": "2014-11-16T08:39:24 +05:00", 199 | "latitude": -32.351031, 200 | "longitude": -152.503969, 201 | "tags": [ 202 | "esse", 203 | "in", 204 | "fugiat", 205 | "officia", 206 | "enim", 207 | "cupidatat", 208 | "aliqua" 209 | ], 210 | "friends": [ 211 | { 212 | "id": 0, 213 | "name": "Lori Whitehead" 214 | }, 215 | { 216 | "id": 1, 217 | "name": "Dunlap Ramos" 218 | }, 219 | { 220 | "id": 2, 221 | "name": "Beth Rose" 222 | } 223 | ], 224 | "greeting": "Hello, Craig Mcleod! You have 10 unread messages.", 225 | "favoriteFruit": "banana" 226 | }, 227 | { 228 | "_id": "5a2e9527e3ad179ec29deb48", 229 | "index": 5, 230 | "guid": "97ab486d-ce8c-4f21-ac56-27313c22c9f7", 231 | "isActive": true, 232 | "balance": "$3,451.14", 233 | "picture": "http://placehold.it/32x32", 234 | "age": 31, 235 | "eyeColor": "blue", 236 | "name": "Knapp Lester", 237 | "gender": "male", 238 | "company": "QUONK", 239 | "email": "knapplester@quonk.com", 240 | "phone": "+1 (845) 418-3633", 241 | "address": "645 Wilson Street, Kiskimere, Massachusetts, 4330", 242 | "about": "Velit anim duis aute pariatur. Laboris eu et amet adipisicing irure ipsum consectetur tempor. Sunt voluptate ut irure occaecat aute laboris irure laborum officia eiusmod commodo.\r\n", 243 | "registered": "2014-06-30T04:57:40 +04:00", 244 | "latitude": 37.751046, 245 | "longitude": -26.462945, 246 | "tags": [ 247 | "officia", 248 | "irure", 249 | "culpa", 250 | "ullamco", 251 | "ut", 252 | "elit", 253 | "ad" 254 | ], 255 | "friends": [ 256 | { 257 | "id": 0, 258 | "name": "Wilder Vargas" 259 | }, 260 | { 261 | "id": 1, 262 | "name": "Barry Lawrence" 263 | }, 264 | { 265 | "id": 2, 266 | "name": "Palmer Wagner" 267 | } 268 | ], 269 | "greeting": "Hello, Knapp Lester! You have 2 unread messages.", 270 | "favoriteFruit": "strawberry" 271 | }, 272 | { 273 | "_id": "5a2e9527e39137911257165b", 274 | "index": 6, 275 | "guid": "011152b1-8daf-4edd-abbc-754c61ab531e", 276 | "isActive": true, 277 | "balance": "$3,674.30", 278 | "picture": "http://placehold.it/32x32", 279 | "age": 27, 280 | "eyeColor": "brown", 281 | "name": "Blake Estrada", 282 | "gender": "male", 283 | "company": "ACCUPHARM", 284 | "email": "blakeestrada@accupharm.com", 285 | "phone": "+1 (810) 562-2836", 286 | "address": "369 Battery Avenue, Hondah, Arizona, 3574", 287 | "about": "Sunt incididunt proident adipisicing ea incididunt ea magna id amet. Anim anim dolore ad est consequat duis aute esse reprehenderit nisi. Adipisicing proident Lorem magna do. Est duis esse consequat quis exercitation elit pariatur consectetur exercitation do proident veniam ut. Aute cillum aute proident ad consectetur ipsum ut tempor irure adipisicing non.\r\n", 288 | "registered": "2017-01-12T09:32:56 +05:00", 289 | "latitude": 32.75109, 290 | "longitude": -62.61648, 291 | "tags": [ 292 | "in", 293 | "dolor", 294 | "magna", 295 | "amet", 296 | "cupidatat", 297 | "velit", 298 | "ex" 299 | ], 300 | "friends": [ 301 | { 302 | "id": 0, 303 | "name": "Howard Downs" 304 | }, 305 | { 306 | "id": 1, 307 | "name": "Rhoda Hanson" 308 | }, 309 | { 310 | "id": 2, 311 | "name": "Francis Scott" 312 | } 313 | ], 314 | "greeting": "Hello, Blake Estrada! You have 1 unread messages.", 315 | "favoriteFruit": "banana" 316 | } 317 | ] --------------------------------------------------------------------------------