Json data formats and two kinds of methods json

A data format

  1. array of ways:

        [
            {"key1": "value1"},

            {"key2": "value2"}

        ]

  2. Object method:

     {

          “key1: "value1",
           "key2": "value2",

           "key3": [

                {"key31": "value31"},
                {"key32": "value32"}
            ]

      }

Two .json method

    1. JSON.stringify ({}, [] , ""), the data sequence into json string
        parameters a: To serialized data (object)
       Parameter II: Control key object, just output specification the property, passing in an array

       Three parameters: After serialization, the printout format (a Tab, more intuitive view json)
   2.JSON.parse (json string); deserialize the data json a js object.

Guess you like

Origin www.cnblogs.com/yehuisir/p/11165809.html