I am working on a project for which there are several values for objects, for example, one of the 'things' There is a list, but there is also another category in everything, "tags" can include things such as round, circle, ball, sports etc. Describing all things, what is 'cheese', I am trying to define it in JSON but I am running in errors with jsonlint. Take a look: {{"name": "cheese 1", "tag": [{"globe", "circle", "round", "world"} "}", {"Name": "cheese 2", "tag": [{"cloud", "weather", "electricity", "sky"}}}, {"name": "cheese 3", "tag": { "{4}", "tag": [{"round", "key", "lock"}}}, {"name": "round", "bulcey", "target"}}, {"name" "Cheese 5", "tag": [{"weather", "sun", "sky", "heat"}}}]
}
Thank you for your help!
Anthony
Your" tag "object appears to me as code:
[{" globe "," circle "," round "," world "}]
An object whose properties have no value, but I'm not sure whether this is a valid syntax. Do you want multiple arrays for "tags"? If so, you have to leave those curly braces:
var myThings = {"things": [{"" name ":" thing1 "," tags ": [" globe ", "Circle", "round", "world"]}]};
This will give you an object with the property "things" which will have an array of "objects" and the "tag" property, where there is an array of the word "tag".
You can access "tags" like this:
var thing1tag2 = myThings.things [0]. Tag [1]; // = "circle"
Comments
Post a Comment