[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: List of differences between XML and JSON?
On 5/3/2015 1:45 AM, Dimitre Novatchev wrote: Well, actually, there is nothing to indicate that these two objects are the same. A javascript engine would create two objects, and if you were to change the properties of one, the other's properties would not automatically change.... Now, notice that the book object representing "The Giver" by Lois Lowry, takes part in both collections. This is another example how two different JSON objects share a single third JSON object. One could argue that these are two different JSON objects that happen to represent the same book. This is not true, because these "two objects" cannot have their own different data and if we want to change, for example, the year when the book was written, we must make the change in both of these "two objects". A graph is a set of nodes and edges. Each edge is labeled with the two nodes that is connects (well, there could be a separate record of these connections, but this is one way). So a simple JSON graph could be given by (omitting quotations marks from the labels "edge" and "node" for simplicity): {graph: {node: "N1"}, {node: "N2"}, {node: "N3"}, {edge: {from: "N1", to: "N2"}}, {edge: {from: "N2", to: "N3"}}, {edge: {from: "N1", to: "N3"}} } You could also use edge:["N1", "N2"], ..., but the first way lets you add other named properties to an edge. You could augment the properties of each node or edge as you like, of course. It's true that nothing in the JSON shows (by the construction of the objects) that the nodes have any relation to the edges. Your code has to provide that interpretation. That's because JSON does not provide a notion of object identity, just objects and lists. But this lack comes from the simplicity.
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|