{"id":13413282,"url":"https://github.com/miladibra10/vjson","last_synced_at":"2026-01-17T17:01:59.049Z","repository":{"id":46091729,"uuid":"362885589","full_name":"miladibra10/vjson","owner":"miladibra10","description":"vjson is a golang package that helps to validate JSON objects","archived":false,"fork":false,"pushed_at":"2025-07-31T20:02:44.000Z","size":82,"stargazers_count":40,"open_issues_count":3,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-31T23:09:12.967Z","etag":null,"topics":["golang","golang-json","json","json-validation","json-validator","schema"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/miladibra10.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-04-29T16:47:50.000Z","updated_at":"2025-07-31T19:59:40.000Z","dependencies_parsed_at":"2024-10-26T09:09:55.061Z","dependency_job_id":"6ac8e2ab-c023-44d3-a88e-a489e6d4018d","html_url":"https://github.com/miladibra10/vjson","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/miladibra10/vjson","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miladibra10%2Fvjson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miladibra10%2Fvjson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miladibra10%2Fvjson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miladibra10%2Fvjson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miladibra10","download_url":"https://codeload.github.com/miladibra10/vjson/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miladibra10%2Fvjson/sbom","scorecard":{"id":646935,"data":{"date":"2025-08-11","repo":{"name":"github.com/miladibra10/vjson","commit":"44bc7b3a4853b63cb7727937e33b26df9cdfb4c8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/25 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":1,"reason":"2 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 19 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":8,"reason":"2 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2021-0265 / GHSA-ppj4-34rq-v8j9","Warn: Project is vulnerable to: GO-2022-0603 / GHSA-hp87-p4gw-j4gq"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T12:22:44.523Z","repository_id":46091729,"created_at":"2025-08-21T12:22:44.523Z","updated_at":"2025-08-21T12:22:44.523Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28511876,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T13:38:16.342Z","status":"ssl_error","status_checked_at":"2026-01-17T13:37:44.060Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["golang","golang-json","json","json-validation","json-validator","schema"],"created_at":"2024-07-30T20:01:36.772Z","updated_at":"2026-01-17T17:01:59.037Z","avatar_url":"https://github.com/miladibra10.png","language":"Go","funding_links":[],"categories":["JSON","Relational Databases"],"sub_categories":["Search and Analytic Databases","检索及分析资料库","Advanced Console UIs"],"readme":"# vjson\n[![codecov](https://codecov.io/gh/miladibra10/vjson/branch/main/graph/badge.svg)](#)\n[![Go Report Card](https://goreportcard.com/badge/github.com/miladibra10/vjson)](https://goreportcard.com/report/github.com/miladibra10/vjson)\n[![\u003cmiladibra10\u003e](https://circleci.com/gh/miladibra10/vjson.svg?style=svg)](#)\n[![Go Reference](https://pkg.go.dev/badge/github.com/miladibra10/vjson.svg)](https://pkg.go.dev/github.com/miladibra10/vjson)\n\n**vjson**  is a Go package that helps to validate JSON objects in a declarative way.\n\n# Getting Started\n\n## Installing\n\nFor installing vjson, use command below:\n\n```\ngo get -u github.com/miladibra10/vjson\n```\n\n# Concepts\n\nThere are two main concepts in `vjson` that are:\n\n+ Schema\n+ Field\n\n## Schema\n\nA schema is the holder of JSON object specifications. It contains the way of validation of a JSON object. a schema\nconsists of an array of fields.\n\n## Field\n\nA field contains characteristics of a specific field of a json object. multiple field types are supported by `vjson`.\nlist of supported types are:\n\n+ `integer`\n+ `float`\n+ `string`\n+ `boolean`\n+ `array`\n+ `object`\n+ `null`\n+ `or`\n\n# How to create a Schema\n\nThere are two ways to create a schema.\n\n+ Schema could be declared in code in a declarative manner.\n+ Schema could be parsed from a file or string.\n\n## Schema in code\n\nSchema could be declared in code like this:\n\n```go\npackage main\n\nimport \"github.com/miladibra10/vjson\"\n\nfunc main() {\n\tschema := vjson.NewSchema(\n\t\tvjson.String(\"name\").Required(),\n\t)\n\n\tjsonString := `\n\t{\n\t\t\"name\": \"James\"\n\t}\n\t`\n\n\terr := schema.ValidateString(jsonString)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}\n```\n\n`schema` object contains a string field, named `name`. This code validates `jsonString`.\n\n## Parse Schema\nSchema could be parsed from a file or a string. These methods help to parse schema.\n\n+ [ReadFromString(input string)](#parse-schema): receives characteristics of a schema in a string format and returns a schema object and an error.\n+ [ReadFromBytes(input []byte)](#parse-schema): receives characteristics of a schema in a byte array format and returns a schema object and an error.\n+ [ReadFromFile(filePath string)](#parse-schema): receives file path of json file which contains characteristics of a schema, and returns a schema object and an error.\n\nFormat of schema for parsing should be a json like this:\n```json\n{\n  \"fields\": [\n    ...\n  ]\n}\n```\n`fields` should contain [field specifications](#fields). \n\nThis code parses a schema from string:\n\n```go\npackage main\n\nimport \"github.com/miladibra10/vjson\"\n\nfunc main() {\n\tschemaStr := `\n\t{\n\t\t\"fields\": [\n\t\t\t{\n\t\t\t\t\"name\": \"name\",\n\t\t\t\t\"type\": \"string\"\n\t\t\t\t\"required\": true\n\t\t\t}\n\t\t]\n\t}\n\t`\n\tschema, err := vjson.ReadFromString(schemaStr)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tjsonString := `\n\t{\n\t\t\"name\": \"James\"\n\t}\n\t`\n\n\terr = schema.ValidateString(jsonString)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}\n```\n\n`schemaStr` describes the schema and `vjson.ReadFromString(schemaStr)` parses the string and returns a schema object.\n\n`schema` object contains a string field, named `name`. This code validates `jsonString`.\n\n\u003e **Note**: You could Marshal your schema as a json object for backup usages with `json.Marshal` function.\n\n# Fields\n\n## Integer\nAn integer field could be created in code like this:\n```go\nvjson.Integer(\"foo\")\n```\nsome validation characteristics could be added to an integer field with chaining some functions:\n\n+ [Required()](#integer) sets the field as a required field. validation will return an error if a required field is not present in json object.\n+ [Min(min int)](#integer) forces the integer field to be greater than `min` in validating json object.\n+ [Max(max int)](#integer) forces the integer field to be lower than `max` in validating json object.\n+ [Positive()](#integer) checks if the value of field is positive.\n+ [Negative()](#integer) checks if the value of field is negative.\n+ [Range(start, end int)](#integer) adds a range for integer field. the value of json field should be within this range.\n\ninteger field could be described by a json for schema parsing.\n+ **`name`**: the name of the field\n+ **`type`**: type value for integer field must be `integer`\n+ `required`: whether the field is required or not\n+ `min`: minimum value of field\n+ `max`: maximum value of field\n+ `positive`: a boolean that describes that a field is positive or negative (`true` for positive and `false` for negative)\n+ `ranges`: an array of ranges to be checked in field validation.\n\n### Example\nan integer field, named `foo` which is required, minimum value should be 2, maximum value should be 10, should be positive and be within range [3,5] or [6,8] ,could be declared like this:\n\n#### Code\n```go\nvjson.Integer(\"foo\").Required().Min(2).Max(10).Positive().Range(3,5).Range(6,8)\n```\n\n#### File\n```json\n{\n  \"name\": \"foo\",\n  \"type\": \"integer\",\n  \"required\": true,\n  \"min\": 2,\n  \"max\": 10,\n  \"positive\": true,\n  \"ranges\": [\n    {\n      \"start\": 3,\n      \"end\": 5\n    },\n    {\n      \"start\": 6,\n      \"end\": 8\n    }\n  ]\n}\n```\n\n## Float\nA float field could be created in code like this:\n```go\nvjson.Float(\"foo\")\n```\nsome validation characteristics could be added to a float field with chaining some functions:\n\n+ [Required()](#float) sets the field as a required field. validation will return an error if a required field is not present in json object.\n+ [Min(min float64)](#float) forces the float field to be greater than `min` in validating json object.\n+ [Max(max float64)](#float) forces the float field to be lower than `max` in validating json object.\n+ [Positive()](#float) checks if the value of field is positive.\n+ [Negative()](#float) checks if the value of field is negative.\n+ [Range(start, end float64)](#float) adds a range for float field. the value of json field should be within this range.\n\nfloat field could be described by a json for schema parsing.\n+ **`name`**: the name of the field\n+ **`type`**: type value for float field must be `float`\n+ `required`: whether the field is required or not\n+ `min`: minimum value of field\n+ `max`: maximum value of field\n+ `positive`: a boolean that describes that a field is positive or negative (`true` for positive and `false` for negative)\n+ `ranges`: an array of ranges to be checked in field validation.\n\n### Example\na float field, named `foo` which is required, minimum value should be 2.5, maximum value should be 10.5, should be positive and be within range [3,5] or [6,8] ,could be declared like this:\n\n#### Code\n```go\nvjson.Float(\"foo\").Required().Min(2.5).Max(10.5).Positive().Range(3,5).Range(6,8)\n```\n\n#### File\n```json\n{\n  \"name\": \"foo\",\n  \"type\": \"float\",\n  \"required\": true,\n  \"min\": 2.5,\n  \"max\": 10.5,\n  \"positive\": true,\n  \"ranges\": [\n    {\n      \"start\": 3,\n      \"end\": 5\n    },\n    {\n      \"start\": 6,\n      \"end\": 8\n    }\n  ]\n}\n```\n\n## String\nA string field could be created in code like this:\n```go\nvjson.String(\"foo\")\n```\nsome validation characteristics could be added to a string field with chaining some functions:\n\n+ [Required()](#string) sets the field as a required field. validation will return an error if a required field is not present in json object.\n+ [MinLength(min int)](#string) forces the length of string field to be greater than `min` in validating json object.\n+ [MaxLength(max int)](#string) forces the length of string field to be lower than `max` in validating json object.\n+ [Format(format string)](#string) gets a `regex` format and checks if value of json object matches the format.\n+ [Choices(choice ...string)](#string) checks if the value of string field is equal to one of choices.\n\nfloat field could be described by a json for schema parsing.\n+ **`name`**: the name of the field\n+ **`type`**: type value for string field must be `string`\n+ `required`: whether the field is required or not\n+ `min_length`: minimum length of string value of field\n+ `max_length`: maximum length of string value of field\n+ `format`: a `regex` format and checks if value of json object matches the format.\n+ `choices`: a list of strings that value of field should be equal to one of them.\n\n### Example\na string field, named `foo` which is required, minimum length value should be 2, maximum length value should be 10, should be Equal to one of these values: `first`, `second` could be declared like this:\n\n#### Code\n```go\nvjson.String(\"foo\").Required().MinLength(2).MaxLength(10).Choices(\"first\", \"second\")\n```\n\n#### File\n```json\n{\n  \"name\": \"foo\",\n  \"type\": \"string\",\n  \"required\": true,\n  \"min_length\": 2,\n  \"max_length\": 10,\n  \"choices\": [\n    \"first\",\n    \"second\"\n  ]\n}\n```\n\n## Boolean\nA boolean field could be created in code like this:\n```go\nvjson.Boolean(\"foo\")\n```\nsome validation characteristics could be added to a boolean field with chaining some functions:\n\n+ [Required()](#boolean) sets the field as a required field. validation will return an error if a required field is not present in json object.\n+ [ShouldBe(value bool)](#boolean) forces the value of field be equal to `value`\n\nboolean field could be described by a json for schema parsing.\n+ **`name`**: the name of the field\n+ **`type`**: type value for boolean field must be `boolean`\n+ `required`: whether the field is required or not\n+ `value`: a boolean (same sa `ShouldBe` in code) that describes that the value of json field.\n\n### Example\na boolean field, named `foo` which is required, and always should be false, could be declared like this:\n\n#### Code\n```go\nvjson.Boolean(\"foo\").Required().ShouldBe(false)\n```\n\n#### File\n```json\n{\n  \"name\": \"foo\",\n  \"type\": \"boolean\",\n  \"required\": true,\n  \"value\": false\n}\n```\n\n## Array\nAn array field could be created in code like this:\n```go\nvjson.Array(\"foo\", vjson.String(\"item\"))\n```\nthe first argument is the name of array field, and the second one is the field characteristics of each item of array.\n\n\nsome validation characteristics could be added to an array field with chaining some functions:\n\n+ [Required()](#array) sets the field as a required field. validation will return an error if a required field is not present in json object.\n+ [MinLength(min int)](#array) forces the length of array field to be greater than `min` in validating json object.\n+ [MaxLength(max int)](#array) forces the length of array field to be lower than `max` in validating json object.\n\narray field could be described by a json for schema parsing.\n+ **`name`**: the name of the field\n+ **`type`**: type value for array field must be `array`\n+ `required`: whether the field is required or not\n+ `min_length`: minimum length of array\n+ `max_length`: maximum length of array\n+ `items`: specifications of item fields. could be any field.\n\n### Example\nan array field, named `foo` with integer items between [0,20] range, which is required, and its length should be at least 2 and at last 10, could be declared like this:\n\n#### Code\n```go\nvjson.Array(\"foo\", vjson.Integer(\"item\").Range(0,20)).Required().MinLength(2).MaxLength(10)\n```\n\n#### File\n```json\n{\n  \"name\": \"foo\",\n  \"type\": \"array\",\n  \"required\": true,\n  \"min_length\": 2,\n  \"max_length\": 10,\n  \"items\": {\n    \"name\": \"item\",\n    \"type\": \"integer\",\n    \"ranges\": [\n      {\n        \"start\": 0,\n        \"end\": 20\n      }\n    ]\n  }\n}\n```\n\n## Object\nAn object field could be created in code like this:\n```go\nvjson.Object(\"foo\", vjson.NewSchema(\n        /// Fields\t\n\t))\n```\nthe first argument is the name of object field, and the second one is the schema of object value. this feature helps validation of nested json objects\n\n\nsome validation characteristics could be added to an array field with chaining some functions:\n\n+ [Required()](#object) sets the field as a required field. validation will return an error if a required field is not present in json object.\n\nobject field could be described by a json for schema parsing.\n+ **`name`**: the name of the field\n+ **`type`**: type value for object field must be `object`\n+ `required`: whether the field is required or not\n+ `schema`: schema of object value.\n\n### Example\na required object field, named `foo` which its valid value is an object with `name` and `last_name` required strings, could be declared like this:\n\n#### Code\n```go\nvjson.Object(\"foo\", vjson.NewSchema(\n\tvjson.String(\"name\").Required(),\n\tvjson.String(\"last_name\").Required(),\n\t)).Required()\n```\n\n#### File\n```json\n{\n  \"name\": \"foo\",\n  \"type\": \"object\",\n  \"required\": true,\n  \"schema\": {\n    \"fields\": [\n      {\n        \"name\": \"name\",\n        \"type\": \"string\",\n        \"required\": true\n      },\n      {\n        \"name\": \"last_name\",\n        \"type\": \"string\",\n        \"required\": true\n      }\n    ]\n  }\n}\n```\n\n## Null\nA null field (a field that its value should be null!) could be created in code like this:\n```go\nvjson.Null(\"foo\")\n```\n\nnull field could be described by a json for schema parsing.\n+ **`name`**: the name of the field\n+ **`type`**: type value for null field must be `null`\n\n### Example\na null field, named `foo`, could be declared like this:\n\n#### Code\n```go\nvjson.Null(\"foo\")\n```\n\n#### File\n```json\n{\n  \"name\": \"foo\",\n  \"type\": \"null\"\n}\n```\n\n## Or\nAn Or field could be created in code like this:\n```go\nvjson.Or(\"foo\", vjson.String(\"bar\"), vjson.Boolean(\"baz\"))\n```\nThe Or field validates if a value matches at least one of the provided field types.\n\nYou can provide the field types directly in the constructor, or add them later using the WithFields method.\n\nsome validation characteristics could be added to an Or field with chaining some functions:\n\n+ [Required()](#or) sets the field as a required field. validation will return an error if a required field is not present in json object.\n+ [WithFields(fields ...Field)](#or) replaces field types to check. The value will be valid if it matches at least one of these field types.\n\nOr field could be described by a json for schema parsing.\n+ **`name`**: the name of the field\n+ **`type`**: type value for Or field must be `or`\n+ `required`: whether the field is required or not\n\n### Example\nan Or field, named `foo` which is required, and accepts either a string or a boolean, could be declared like this:\n\n#### Code\n```go\nvjson.Or(\"foo\", vjson.String(\"bar\"), vjson.Boolean(\"baz\")).Required()\n```\n\nAlternatively, you can add fields using the WithFields method:\n\n```go\nvjson.Or(\"foo\").Required().WithFields(vjson.String(\"bar\"), vjson.Boolean(\"baz\"))\n```\n\n#### File\n```json\n{\n  \"name\": \"foo\",\n  \"type\": \"or\",\n  \"required\": true,\n  \"fields\": [\n    {\n      \"name\": \"foo\",\n      \"type\": \"null\"\n    },\n    {\n      \"name\": \"foo\",\n      \"type\": \"string\",\n      \"required\": true\n    }\n  ]\n}\n```\n\n# Validation\nAfter creating a schema, you can validate your json objects with these methods:\n\n+ [ValidateBytes(input []byte)](#validation): receives a byte array as a json input and validates it. this method returns an error. it would be `nil` if the object is valid, and it will return an error if the input object is not valid.\n+ [ValidateString(input string)](#validation): acts like `ValidateBytes` but its argument is string.\n\n# Example\nThis code validates an object that should have `name` and `age` fields.\n```go\npackage main\n\nimport \"github.com/miladibra10/vjson\"\n\nfunc main() {\n\tschema := vjson.NewSchema(\n\t\tvjson.String(\"name\").Required(),\n\t\tvjson.Integer(\"age\").Positive(),\n\t)\n\n\tjsonString := `\n\t{\n\t\t\n  \"required\": true,\n  \"value\": false\"name\": \"James\"\n\t}\n\t`\n\n\terr := schema.ValidateString(jsonString)\n\tif err != nil {\n\t\tpanic(err) // Will not panic\n\t}\n\n\tjsonString = `\n\t{\n\t\t\"name\": \"James\",\n        \"age\": 10\n\t}\n\t`\n\n\terr = schema.ValidateString(jsonString)\n\tif err != nil {\n\t\tpanic(err) // Will not panic\n\t}\n\n\tjsonString = `\n\t{\n        \"age\": 10\n\t}\n\t`\n\n\terr = schema.ValidateString(jsonString)\n\tif err != nil {\n\t\tpanic(err) // Will panic because name field is missing in jsonString\n\t}\n\n}\n```\n\n# Benchmarks\n\nResults of benchmarking validation functions highly depends on types and number of fields.\n\ntwo simple benchmarks (exists in `schema_test.go` file) with using all features of `vjson` gives this result:\n\n```\ngoos: linux\ngoarch: amd64\npkg: github.com/miladibra10/vjson\nBenchmarkSchema_ValidateString-8          416664              2792 ns/op\nBenchmarkSchema_ValidateBytes-8           431734              2858 ns/op\nPASS\nok      github.com/miladibra10/vjson    2.461s\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiladibra10%2Fvjson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiladibra10%2Fvjson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiladibra10%2Fvjson/lists"}