One thing Ive learned during my journey as a web developer is that no matter how devoted I am to its subjects in spirit, finding time for said devotion is another matter. The rapidly evolving world of technology is not concerned about how busy anyone is. It does not say, Relax, take your time to study, I understand you have a family and quiet time for studying is difficult to come by. What it says is, Keep evolving, or become obsolete.
I wrote this book with that sentiment in mind. This book is slimit intentionally avoids subjects like the history of JSON.
Although I am grateful to Douglas Crockford for discovering JSON, I make no mention of him or the years during which JSON evolved into what it is today. This book is about what it is today. If you want to read about this history of JSON, Wikipedia has an excellent summary.
This book aims to shoot for the very heart of the subject of JSON. It is about getting to the point and getting you started quickly. It is for the busy IT professional.
Audience
As I wrote this book for the busy IT professional, I also thought quite a bit about who you are. You could be a beginning frontend web developer. Or perhaps youve been focused on server-side web application development for years, and now you need to learn JSON for a web API. You could be a PHP, Ruby, C, Java, or ASP.NET developer. That list goes on. A lot of different people in different roles want and need to learn JSON.
In this book, I avoid excessive jargon and explain prerequisite concepts for those new to web programming. I try to speak to all of you. However, I must make a few assumptions about what knowledge you already have. If you are new to web development, this should not be the very first book you pick up.
I assume you have at least a basic understanding of:
HTMLYou understand the purpose of HTML and can recognize the structure and at least a few of the tags of an HTML document.JavaScriptYou understand the purpose of JavaScript and know what a tag, function, and variable are. Its OK if you are only a beginner. I keep my code examples simple.Programming conceptsI will provide some quick explanations for concepts like object and array, for those who are new and may need a refresher. However, if you have not yet worked with
any programming language, this book is not the place to begin.
Approach to JSON
Countless times over the years Ive needed to learn new technologies, often during a project with a deadline. I buy big books, wade through tutorials, and try to absorb enough information to know what Im doing. While Im wading through hundreds of pages, Im looking for the answers to these three basic questions:
- What is it?
- How can I use it?
- How can the bad guys use it?
When I wrote this book, I sought to get to the point with these questions, so you dont have to wade through to find the answers.
In Chapters , we will explore JSON at a low level. First, I will answer the ultimate question of What is it? From there, we will look at syntax, syntax validation, data types, and schema validation.
In , we will take a look at the important subject of security concerns. This chapter includes a primer on client-side and server-side concepts that are important to the remainder of the book. This chapter will answer the question of How can the bad guys use it?
The remaining chapters examine the many roles that JSON plays as a data interchange format. These chapters aim to answer the question, How can I use it?
These chapters include many examples of JSON, and technologies interacting with JSON. Some important things to note about Chapters :
Technologies
I cover several technologies, such as jQuery, AngularJS, and CouchDB, at a high level. Each of these subjects are large enough that an entire book can (and has) been written about them. I intentionally leave out installation instructions and deeper explanations about the technologies themselves. The point is to expose you to how these technologies are using JSON.
If you want to try out the examples shown for these technologies, youll need to do some legwork to set everything up. However, the examples are simple. If you get things up and running at a basic level, you should be able to give them a whirl.
Code examples
You will see many code examples in this book, some in programming languages that might be new to you. The syntax will not be explained for these languages. Do not be alarmed if you dont understand the syntax. The point is for you to get the gist of what the code is doing, and the explanation of what the code is doing shall be provided.
All of the code examples used in this book are available on this books GitHub repository.
The ultimate point of Chapters is to expose you to how JSON is being used out in the world today, and to get your idea wheels spinning for your own projects. If you never saw JSON being used as a document in a document store database, would you think to use it in a project? Knowing is half the battle.
In each chapter, a balance is sought between getting to the point and giving you enough information so that you are not left with any major holes in your education. Ultimately, the entire book is structured to get you up and running with JSON quickly, without sacrificing the deeper understanding of what JSON is and the purposes it may serve.
Conventions Used in This Book
The following typographical conventions are used in this book:
ItalicIndicates new terms, URLs, email addresses, filenames, and file extensions.
Constant width
Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.