Reading:  

Getting start with JSON


Schema

JSON Schema is specification for JSON based formatting structure of JSON data. The JSON Schema specification is divided into three parts:

 

JSON Schema Core: The JSON Schema Core consists of terminology for a schema definition. This is similar to DOCTYPE declaration in HTML 4.01 and other older HTML versions. 

JSON Schema Validation: The JSON Schema Validation specifics valid ways to define validation constraints. 

JSON Hyper-Schema: It is another extension of JSON Schema spec, where hyperlink and hypermedia-related keywords are defined.

 

JSON Schema defines:

  • describes existing data format
  • human and machine-readable , clear documentation
  • complete structural validation
  • automated testing
  • validating client-submitted data

JSON Schema example

{
	"title": "Schema Example",
	"type": "object",
	"properties": {
		"firstName": {
			"type": "string"
		},
		"lastName": {
			"type": "string"
		},
		
	},
	"required": ["firstName", "lastName"]
}
 

Below are the important keywords used in schema:

 

Keyword

Description

title

Schema Title

description

Schema description

type

The type keyword defines first constraint on our JSON data

properties

Defines keys and value types used in JSON file.

required

List of required properties.

minimum

It represents minimum acceptable value.

maximum

It represents maximum acceptable value.

 

In next part we will explore some advantage of JSON over XML

Description

In this tutorial you will learn 

  1. What is JSON
  2. Syntax
  3. Datatypes with JSON
  4. Objects
  5. Schema
  6. XML vs JSON
  7. Using with PHP and Java

This tutorial is a quick walkthrough over the technology

 



Learning Objectives

Objective of this tutorial is to give you enough information on JSON to get you started with the technology

Author: Subject Coach
Added on: 20th Jul 2015

You must be logged in as Student to ask a Question.

None just yet!