Most place the JSON is in format like
{
color: "red",
value: "#f00"
}
Or
[
{ color: "red", value: "#f00" },
{ color: "red", value: "#f00" }
]
And I want to ask is primitive type like string, bool, int also JSON?
I have found follow link,
http://json-schema.org/latest/json-schema-core.html
https://zh.wikipedia.org/wiki/JSON
https://www.ietf.org/rfc/rfc4627.txt
http://www.c-sharpcorner.com/uploadfile/3d39b4/data-types-in-json/
And,
In RFC4627 it says
JSON can represent four primitive types (strings, numbers, booleans, and null) and two structured types (objects and arrays).
A string is a sequence of zero or more Unicode characters [UNICODE].
An object is an unordered collection of zero or more name/value pairs, where a name is a string and a value is a string, number, boolean, null, object, or array.
An array is an ordered sequence of zero or more values.
The terms "object" and "array" come from the conventions of JavaScript.
So I reading it as pure string, number boolean like
"a string"
100
true
Are all JSON,
But two of my colleagues think that primitive types can only be value in object,
{ ASTRING : "astring" }
is JSON,
And if there's only "a string"
, this is not called, as it is not JSON format,
I think I, and my colleagues may not be professional enough to judge it,
So I want to know, is pure primitive type JSON?
.
Another idea for me is that , JSON is called a convenient way to exchanging data, but if this format didn't support pure string,
that is, if I just want to throw out a string, I can't use JSON to do it?
and have to force it change to { Message : "a message"}
,
and cannot use a way which I think is simpler just throw "a message"
...?