Is a primitive type considered JSON?

后端 未结 3 859
粉色の甜心
粉色の甜心 2021-02-14 10:31

Most place the JSON is in format like

{
    color: \"red\",
    value: \"#f00\"
}

Or

[  
    { color: \"red\",     value: \"#f0         


        
3条回答
  •  说谎
    说谎 (楼主)
    2021-02-14 11:07

    The relevant RFC is RFC 7159, not RFC 4627. RFC 4627 is "informational". RFC 7159 is "standards track"; it explicitly obsoletes RFC 4627.

    Request for Comments: 7159                                  Google, Inc.
    Obsoletes: 4627, 7158                                         March 2014
    Category: Standards Track
    ISSN: 2070-1721
    

    In the text of RFC 7159, you'll find this.

    13.  Examples
    
       This is a JSON object:
    
          {
            "Image": {
                "Width":  800,
                "Height": 600,
                "Title":  "View from 15th Floor",
                "Thumbnail": {
                    "Url":    "http://www.example.com/image/481989943",
                    "Height": 125,
                    "Width":  100
                },
                "Animated" : false,
                "IDs": [116, 943, 234, 38793]
              }
          }
       [snip]
       Here are three small JSON texts containing only values:
    
       "Hello world!"
    
       42
    
       true
    

提交回复
热议问题