{"id":24511625,"url":"https://github.com/moappi/json-filter","last_synced_at":"2025-04-14T08:22:08.682Z","repository":{"id":57311416,"uuid":"80883050","full_name":"moappi/json-filter","owner":"moappi","description":"Filtering for JSON objects","archived":false,"fork":false,"pushed_at":"2021-08-25T19:52:21.000Z","size":10,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T12:46:44.409Z","etag":null,"topics":["javascript","json","node-js","node-module","nodejs"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moappi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-04T01:09:09.000Z","updated_at":"2023-08-02T22:26:25.000Z","dependencies_parsed_at":"2022-09-12T02:42:28.923Z","dependency_job_id":null,"html_url":"https://github.com/moappi/json-filter","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moappi%2Fjson-filter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moappi%2Fjson-filter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moappi%2Fjson-filter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moappi%2Fjson-filter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moappi","download_url":"https://codeload.github.com/moappi/json-filter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248844096,"owners_count":21170513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","json","node-js","node-module","nodejs"],"created_at":"2025-01-22T00:39:20.364Z","updated_at":"2025-04-14T08:22:08.636Z","avatar_url":"https://github.com/moappi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"json-filter\n=========\n\nUsage (browser)\n------------\n\n\tlet filter = new JSON.filter({\"allowed\":\"$string\"});\n\n\tlet output = filter.apply({\"allowed\":\"this is allowed\",\"notallowed\":\"this is not allowed\"});\n\t\n\t//output = {\"allowed\":this is allowed\"}\n\n\nUsage (node.js)\n------------\n\n\tnpm install node-json-filter\n\n\tJSON.filter = require(\"node-json-filter\");\n\n\nWhat is json-filter?\n--------------\njson-filter extends JSON with a filter function that will helps validate 'unverified' JSON objects.\n\n+\tVerifies object name and value type\n+\tAllows for multiple types of objects (arrays, json objects, strings, numbers etc..) \n+\tVerifies array objects with a single filter\n+\tAble to verify complex json objects (nested arrays, objects etc..)\n+\tAllows for simple switch cabilitity (case \u0026 default)\n\nUsage\n-----\n```javascript\n\n\t//If using in NODE.js (otherwise ignore)\n\tJSON.filter = require('node-json-filter');\n\t\n\tvar filter = new JSON.filter( {\n\t\t\"str\":\"$string\",\n\t\t\"num\":\"$number\",\n\t\t\"bool\":\"$boolean\",\n\t\t\"obj\":{\"str\":\"$string\"},\n\t\t\"arry\":[\"$string\"],\n\t\t\"arryobj\":[\n\t\t    {\"str\":\"$string\"}\n\t\t],\n\t\t\"complex\":{\n\t\t    \"arry\":[\n\t\t\t{\"num\":\"$number\"}\n\t\t    ],\n\t\t    \"obj\":{\"str\":\"$string\"},\n\t\t    \"num\":\"$number\"\n\t\t},\n\t\t\"parsing\":[{\n\t\t    \"num\":\"$number\",\n\t\t    \"bool\":\"$boolean\",\n\t\t    \"str\":\"$string\"\n\t\t}],\n\t\t\"all\":{\n\t\t    \"$all\":{\n\t\t        \"str\":\"$string\",\n\t\t        \"num\":\"$number\"\n\t\t    }\n\t\t},\n\t\t\"default\":{\n\t\t    \"$default\":{\n\t\t        \"str\":\"$string\",\n\t\t        \"num\":\"$number\",\n\n\t\t\t\"$default\":\"$string\"\n\t\t    }\n\t\t}\n\t});\n\n\tconsole.log( filter.apply({\n            \"str\":\"test\",\n            \"num\":123,\n            \"bool\":true,\n            \"obj\":{\"str\":\"test\"},\n\t    \"arry\":[\"test\",\"me\",\"out],\n            \"arryobj\":[\n                {\"str\":\"test1\"},\n                {\"str\":\"test2\"},\n                {\"str\":\"test3\"}\n            ],\n            \"complex\":{\n                \"arry\":[\n                    {\"num\":12},\n                    {\"num\":\"123\"},\n                    {\"num\":12.3}\n                ],\n                \"obj\":{\"str\":\"test123\"},\n                \"num\":\"12.5\"\n            },\n    \t    \"parsing\":[\n        \t\t{\"num\":\"12\",\n        \t\t \"bool\":\"true\",\n        \t\t \"str\":\"some str\"},\n        \t\t{\"num\":\"12.5\",\n        \t\t \"bool\":\"false\"},\n        \t\t{\"num\":\"don't show this one\",\n        \t\t \"bool\":0},\n        \t\t{\"bool\":1},\n        \t\t{\"bool\":\"don't show this one\"}\n    \t    ],\n    \t    \"all\":{\n    \t        \"test1\":{\n    \t            \"str\":\"test\",\n    \t            \"num\":123\n    \t        },\n    \t        \"test2\":{\n    \t            \"str\":\"test\",\n    \t            \"num\":1234\n    \t        }\n    \t    },\n\n\t    \"default\":{\n\t    \t//Specified directly (case)\n    \t        \"str\":\"testy\",\n    \t        \"num\":123,\n\t\t\n\t\t//Covered by $default\n\t\t\"someother\":\"stuff\",\n\t\t\"plusthis\":\"stuff\"\n    \t    },\n    \t    \"filterout\":\"you won't see this property\"\n        }));\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoappi%2Fjson-filter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoappi%2Fjson-filter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoappi%2Fjson-filter/lists"}