想仔細了解 Json 的可以參考一下 json.org

Json 都是名-值對(key value pair),需要注意 keyvalue 都要使用"包起來,key 不使用的話就是 JavaScript 物件了,嚴格上來說是不同的,雖然在 JavaScript

中,都是一樣可以讀取。

 

code snippets(一)

正確格式。

{
	"name":"allen",
	"gender":"male"
}

 

頂層 Json 陣列,這是有效的 json,建議不要如此使用,有安全性風險;這是假如在值的部分放入了方法,再使用 script 的方式引入。

code snippets(二)

[
	{"user":"allen"},
	{"gender":"male"}
]

 

Json 資料型別

★ Object

★ String

★ Number

★ Boolean

★ Null

★ Array

 

Json 需要跳脫字元

★ \/(斜線)

★ \b(後退)

★ \f(送出)

★ \t(tab)

★ \n(換行)

★ \r(回車)

★ \u 後面接16進位字元

 

Json 語法檢驗

JSON Formatter & Validator

JSON Editor Online

JSONLint

 

Json 結構描述

JSON 結構描述

JSON 結構描述檢驗規格

JSON Schema Lint

JSON Schema Validator

 

 

Reference:https://shunnien.github.io/2016/06/11/json-note/

Reference:http://json.org/

Reference:http://jsonformatter.curiousconcept.com/

Reference:https://www.jsoneditoronline.org/

Reference:http://jsonlint.com/

Reference:http://json-schema.org/

Reference:http://json-schema.org/latest/json-schema-validation.html

Reference:http://jsonschemalint.com/draft4/

Reference:http://www.jsonschemavalidator.net/

arrow
arrow
    文章標籤
    [JSON]
    全站熱搜

    mitblog 發表在 痞客邦 留言(0) 人氣()