XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
An argument for dropping (deleting) namespace prefixes whenconverting XML to JSON

Hi Folks,

 

Consider the bk: namespace prefix in this XML snippet:

 

    <bk:Title>The Adventures of Huckleberry Finn</bk:Title>

 

How would you convert that XML to JSON? Would you create this JSON:

 

   "bk:Title": "The Adventures of Huckleberry Finn"

 

I will argue against doing that. The bk: prefix has meaning to XML parsers and XML applications, but it has no meaning to JSON parsers or JSON applications. In fact, the whole notion of namespaces is foreign to JSON.

 

Emulating XML with JSON is a bad idea.

 

When converting XML to JSON I recommend dropping (deleting) all namespace prefixes. Further, drop/delete all namespace declarations. Thus, convert the above XML to this JSON:

 

   "Title": "The Adventures of Huckleberry Finn"

 

If it is necessary to indicate that the Title is a book title, then create this JSON:

 

    "Book Title": "The Adventures of Huckleberry Finn"

 

I invite your thoughts on this issue.

 

/Roger



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS