What is JSON and why would I use it?

前端 未结 17 1856
说谎
说谎 2020-11-21 15:54

I\'ve looked on wikipedia and Googled it and read the official documentation, but I still haven\'t got to the point where I really understand what JSON is, and why I\'d use

17条回答
  •  不思量自难忘°
    2020-11-21 16:07

    What is JSON?

    JavaScript Object Notation (JSON) is a lightweight data-interchange format inspired by the object literals of JavaScript.

    JSON values can consist of:

    objects (collections of name-value pairs) arrays (ordered lists of values) strings (in double quotes) numbers true, false, or null

    JSON is language independent.

    JSON with PHP?

    After PHP Version 5.2.0, JSON extension is decodes and encodes functionalities as default.

    Json_encode - returns the JSON representation of values Json_decode - Decodes the JSON String Json_last_error - Returns the last error occured.

    JSON Syntax and Rules?

    JSON syntax is derived from JavaScript object notation syntax:

    Data is in name/value pairs Data is separated by commas Curly braces hold objects Square brackets hold arrays

提交回复
热议问题