What Is JSON?

JSON, which stands for Javascript Object Notation, is a bit beyond the scope of this book, but it's important to take a quick detour to discuss it, as it seems to be emerging as the most relevant format for REST services. So what is JSON? JSON is a lightweight text-based data interchange format that is easy for both humans and computers to digest and consume. At its inception, JSON was designed to represent simple data structures. Although it was originally conceived as a way to transmit JavaScript-friendly data in particular, parsers are now available for it in virtually every computer language. In PHP, a pair of native JSON functions help you do a lot of heavy lifting (json_encode and json_decode). Simply send in an array of data ...

Get Pro PHP Security: From Application Security Principles to the Implementation of XSS Defenses, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.