[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: List of differences between XML and JSON?

  • From: Thomas Passin <list1@tompassin.net>
  • To: "xml-dev@lists.xml.org" <xml-dev@lists.xml.org>
  • Date: Sun, 03 May 2015 08:42:06 -0400

Re:  List of differences between XML and JSON?
On 5/3/2015 1:45 AM, Dimitre Novatchev wrote:
...
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".
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.

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!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.