Q:

MarkLogic REST API - JSON Response

I'm using the MarkLogic 7 REST API to build an AngularJS application on top of an XML document database. My documents are in NEWSML-G2 format. I've configured custom query options to return only the title and the creation date for each document that matches the search string. The problem is this.
I have a title element in my XML.
<nitf version="-//IPTC//DTD NITF 3.6//EN" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:newzmeta="http://newz.nl/metadata/" xmlns="http://iptc.org/std/NITF/2006-10-18/">
<head>
<title newz:origin="Generated" xmlns:newz="http://newz.nl/">Test Article</title>
....
</nitf>

In my custom query options, I've used the following line.
<extract-metadata>
  <qname elem-ns="http://iptc.org/std/NITF/2006-10-18/" elem-name="title"/>
  ....
</extract-metadata>

Now, the problem is that when I hit the REST interface to make a query and ask for results in JSON format, I get the following in the response
"metadata":[{"{http://iptc.org/std/NITF/2006-10-18/}title":"Obama assumes the office of the President of the United States","metadata-type":"element"},{"  {http://iptc.org/std/nar/2006-10-01/}firstCreated":"2009-01-20T05:00:09","metadata-type":"element"}]

How do I retrieve the title value on the UI side? I get a syntax error if I ask for
 result.metadata.{http://iptc.org/std/NITF/2006-10-18/}title

Is there a way specifically to access this value, or to somehow change the name of the element that's returned from the MarkLogic side?

A:

You can do this:
result.metadata.['{http://iptc.org/std/NITF/2006-10-18/}title']

The bracket notation is used to access properties whose names are not valid JavaScript identifiers, preventing you from using the dot notation. 

