Getting start with JSON
Chapters
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
- What is JSON
- Syntax
- Datatypes with JSON
- Objects
- Schema
- XML vs JSON
- 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!