26
Copyright © 2015 Open Geospatial Consortium.
{ onlineResource:
http:cida.usgs.gov:80nwcgeoserverNHDPlusFlowlineswfs?reque st=GetCapabilities
}
In addition, it could be useful to differentiate an empty attribute from a null element. For example:
tree value=false child
child2child2 tree
it will be transformed into this:
tree : { child : null
child2 : }
Recommendation 8: Produce an OGC best practice for converting XML documents into JSON based on OGC 14-009r1 and some other considerations exposed in this ER.
Target: OWS Common
6.1.2 Exceptions to the general rules
6.1.2.1 Encoding the Object-property alternation in JSON
GML and ISO 19115 are two examples of documents that use the object-property model where objects names in fact the class names in UpperCamelCase contain only property
names in lowerCamelCase. Properties can be defined as objects again in UpperCamelCase. When translating into JSON the class name needs to be removed and
substituted by a type key e.g. type with a reference to a class type name.
This way, the following XML fragment:
mdb:MD_Metadata mdb:contact
cit:CI_Responsibility cit:party
cit:CI_Organisation cit:name
gco:CharacterStringInstitut Cartogrà fic de Catalunya ICCgco:CharacterString
cit:name cit:contactInfo
cit:CI_Contact
Copyright © 2015 Open Geospatial Consortium.
27
cit:address cit:CI_Address
cit:deliveryPoint gco:CharacterStringParc de
Montjuà ¯cgco:CharacterString
cit:deliveryPoint cit:city
gco:CharacterStringBarcelonagco:CharacterString cit:city
cit:postalCode gco:CharacterStringE-
08038gco:CharacterString cit:postalCode
cit:electronicMailAddress gco:CharacterStringcentre.atencioicc.catgco:CharacterStri
ng cit:electronicMailAddress
cit:CI_Address cit:address
cit:CI_Contact cit:contactInfo
cit:CI_Organisation cit:party
cit:CI_Responsibility mdb:contact
mdb:MD_Metadata
should be encoded in JSON like this:
{ type: mdb:MD_Metadata,
contact:{ type: cit:CI_Responsibility,
party: { type: cit:CI_Organisation,
name: Institut Cartogràfic de Catalunya ICC, contactInfo: {
type: cit:CI_Contact, address: {
type: cit:CI_Address, deliveryPoint: Parc de Montjuïc,
city: Barcelona, postalCode: E-08038,
electronicMailAddress: centre.atencioicc.cat }
} }
}